0

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
  • What does namei -l /home say? please edit your question to include the output Feb 18, 2021 at 22:52

2 Answers 2

0

Try using

sudo useradd bob -m -r -p password

useradd 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.

0

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.

1
  • I used the adduser bob , then again the same error occurred.
    – User124356
    Feb 18, 2021 at 22:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .