BuycPanel Blog

BuycPanel Blog

Latest news and updates

3/10/2015 – Fixing the ‘Unable to Add the User’ Error

Posted by Jamison on 10 03 2015.

cPanel lets you add users easily without going through the command console. But whenever you use cPanel, there may be a chance that you have conflicts with adding users. Just like any system, your users can have registration problems and miss important information or whatnot.

 

Here are some of the errors that can come up when you add users to cPanel:

 

Error 1:
WHM >> Account Functions >> Create a New Account
Account Creation Status: failed

 

Error 2:
Unable to add user username

 

Error 3:
root@pro [/usr/local/apache/htdocs]# adduser testuser
adduser: unable to lock password file

 

Error 4:
groupadd: unable to lock group file
[2012-03-14 20:13:04 -0400] warn [whostmgr5] Attempt to repair system password files because we received an error
while adding a user: signal=[0] code=[10]. at /usr/local/cpanel/Cpanel/SysAccounts.pm line 180

 

Error 5:
[2012-03-14 21:58:25 -0400] warn [whostmgr5] Attempt to repair system password files because we received an error
while adding a user: signal=[0] code=[10]. at /usr/local/cpanel/Cpanel/SysAccounts.pm line 180
Cpanel::SysAccounts::_run_pw_cmds(ARRAY(0xfd15320), ARRAY(0xfe7cd30)) called at
/usr/local/cpanel/Cpanel/SysAccounts.pm line 58
Cpanel::SysAccounts::add_system_user(‘abatal’, ‘pass’, ‘g.XXDKBUplXP’, ‘uid’, 2561, ‘gid’, 2546,
‘homedir’, ‘/home/abatal’, ‘homedir_root’, ‘/home’, ‘shell’, ‘/usr/local/cpanel/bin/noshell’) called at
/usr/local/cpanel/Whostmgr/Accounts/Create.pm line 658
Whostmgr::Accounts::Create::_wwwacct(‘plan’, ‘dwhostco_Limitless’, ‘maxpark’, ‘unlimited’, ‘hasshell’,
‘n’, ‘maxlst’, ‘n’, ‘maxpop’, ‘n’, ‘maxaddon’, ‘unlimited’, ‘cpmod’, ‘x3?, ‘pass’, ‘g.XXDKBUplXP’,
‘no_cache_update’, 0, ‘force’, undef, ‘maxsub’, ‘n’, ‘domain’, ‘albaitalaali.com’, ‘maxsql’, ‘n’, ‘quota’, 0,
‘installfp’, ‘n’, ‘maxftp’, ‘n’, ‘mxcheck’, ‘local’, ‘locale’, ‘en’, ‘contactemail’, ‘mdmastoor@gmail.com’,
‘hascgi’, ‘y’, ‘user’, ‘abatal’, ‘useip’, ‘n’, ‘useregns’, 0, ‘bwlimit’, 0, ‘forcedns’, 0, ‘owner’, ‘dwhostco’,
‘is_restore’, 0, ‘featurelist’, ‘dwhostco_DW3?) called at /usr/local/cpanel/Whostmgr/Accounts/Create.pm line 1777
Whostmgr::Accounts::Create::_createaccount(‘sign’, ”, ‘mxcheck’, ‘local’, ‘plan’, ‘dwhostco_Limitless’,
‘language’, ‘en’, ‘contactemail’, ‘mdmastoor@gmail.com’, ‘password’, ‘g.XXDKBUplXP’, ‘cgi’, 1, ‘username’,
‘abatal’, ‘domain’, ‘albaitalaali.com’, ‘dbuser’, ‘abatal’, ‘hasuseregns’, 1) called at whostmgr/bin/whostmgr5
line 562
main::wwwacct() called at whostmgr/bin/whostmgr5 line 211
groupadd: unable to lock shadow group file

 

So how do you fix the message, ‘unable to add user’?

 

The main problem here is that the user may already exist on your system. If this is the case, use your operating system’s user deletion tool to delete that user.

 

To check whether the user already exists, log in to your server and perform the following actions:

 

  • Check the /home/username directory for a home directory for that user.
  • Check the contents of the /etc/passwd directory for an entry for that user.

 

Other experts also have a WHM solution for your problem:

 

If the WHM returns the following error while creating new account on WHM,
Account Creation Status: failed (Unable to add user username)
Unable to add user username
You should check the cPanel error log and you can find some logs similar like below:

 

vipw lockfile (/etc/ptmp) is present.
vipw lockfile (/etc/ptmp) is present.

 

Solution: See if the lock file /etc/ptmp is present; if so, remove it.

 

If you’re on WHM, here are some things that you can do as well:

 

1) root@pro [/etc]# rm .pwd.lock
rm: remove regular empty file `.pwd.lock’? y
root@pro [/etc]#

 

2) cd /etc
find *.lock
or
find -type f -name “*.lock” -ok rm -v {};

and remove the lock file.

 

3) Check if any process currently has the shadow password file open using:

 

fuser /etc/group*
fuser /etc/gshadow*

 

Also you can check if files having immutable bit set and having correct permission:
lsattr /etc/group*

 

4) Check for below associated lock files and you can removed it(as per the error you are getting)
> group >>        (Lock File)   group.lock
> gshadow >>  (Lock File)   gshadow.lock
> shadow >>    (Lock File)    shadow.lock
> passwd >>     (Lock File)    passwd.lock