root@ubuntu:/# adduser "MYNEWUSER" Adding user `"MYNEWUSER"' ... Adding new group `"MYNEWUSER"' (1001) ... Adding new user `"MYNEWUSER"' (1001) with group `"MYNEWUSER"' ... Creating home directory `/home/"MYNEWUSER"' ... Copying files from `/etc/skel' ... Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully Changing the user information for "MYNEWUSER" Enter the new value, or press ENTER for the default Full Name : MY Username Room Number : Work Phone : Home Phone : Other : Is the information correct? [Y/n] Y
Now, if we check the home directory of the newly created user, we will see it only created “examples.desktop” and nothing else like Desktop, Downloads etc.
$ ls /home/MYNEWUSER/ examples.desktop
Note: if we want to have those all directories, we have to logout currrent user from GUI i.e. from Top Right -> Settings Wheel -> Select Newly created user Or click “Logout” and then login to new user from GUI, and we will see the directores like below created now,
$ ls /home/MYNEWUSER/
dead.letter Desktop Documents Downloads examples.desktop Music Pictures Public Templates Videos
root@ubuntu:/# su "MYNEWUSER"
We have added a new user “MYNEWUSER” , but this user will not have a sudo permission which we can check it as,
"MYNEWUSER"@ubuntu:/$ sudo ls sudo: unable to resolve host ubuntu [sudo] password for "MYNEWUSER": "MYNEWUSER" is not in the sudoers file. This incident will be reported.
Now to add this user in the sudoer’s list, please check the post at http://www.lynxbee.com/fix-lost-sudo-user-in-linux/
This can also be done as,
$ sudo su
root@ubuntu:/# adduser MYNEWUSER sudo sudo: unable to resolve host ubuntu Adding user `MYNEWUSER' to group `sudo' ... Adding user MYNEWUSER to group sudo Done.
To delete the user and its home directory, use below command,
$ sudo deluser --remove-home MYNEWUSER