I tried to create a new user account. The following error occurred when I tried to run sudo adduser bob
[root@IU:~# sudo adduser bob
Adding user `bob' ...
Adding new group `bob' (1007) ...
Adding new user `bob' (1006) with group `bob' ...
Creating home directory `/home/bob' ...
Stopped: Couldn't create home directory `/home/bob': Permission denied.
Removing directory `/home/bob' ...
Removing user `bob' ...
Removing group `bob' ...
groupdel: group 'bob' does not exist
adduser: `groupdel bob' returned error code 6. Exiting. 1 2 Answers
Try using
sudo useradd bob -m -r -p passworduseradd is an advanced version of adduser. This example does the following:
-m makes a home directory.-r adds to the sudoers file (this is not recommended for normal users, as sudo can break anything)-p adds a password. You can manually do this by using su bob and executing passwd.
The adduser command creates a home directory for the newly added user by default.
The command sudo adduser bob returned a Couldn't create home directory `/home/bob': Permission denied error message because you are already root at the command line prompt and don't need to use sudo to obtain root permissions from the # command line prompt. Please close the terminal and reopen it. Then sudo adduser bob will run from the $ command line prompt without an error. If you only have access to a root user account that shows you a # command line prompt, then adduser bob without sudo will work after reopening the terminal or else try running exit to try to exit from running with root privileges, but it might just close the terminal window instead because your current user is root@IU.