Advertisement
Guest User

Untitled

a guest
Jul 16th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. # Create Users and Manage Their Sudo Privileges on Ubuntu
  2. To demonstrate, I use the `newuser` as user name
  3.  
  4. ### Add a new user with `adduser`
  5.  
  6. ```bash
  7. # adduser newuser
  8. Adding user `newuser' ...
  9. Adding new group `newuser' (1001) ...
  10. Adding new user `newuser' (1001) with group `newuser' ...
  11. Creating home directory `/home/newuser' ...
  12. Copying files from `/etc/skel' ...
  13. Enter new UNIX password:
  14. Retype new UNIX password:
  15. passwd: password updated successfully
  16. Changing the user information for newuser
  17. Enter the new value, or press ENTER for the default
  18. Full Name []: New User
  19. Room Number []: 101
  20. Work Phone []: 123456
  21. Home Phone []: 123456
  22. Other []:
  23. Is the information correct? [Y/n] y
  24. ```
  25.  
  26. ### Add sudo privileges with `usermod`
  27.  
  28. ```bash
  29. # usermod -aG sudo newuser
  30. ```
  31.  
  32. ### Switch to the new account with `su`
  33. ```bash
  34. # su - newuser
  35. ```
  36.  
  37. After this command, you should be login with the new account
  38.  
  39. ### Test it with a `sudo` command
  40. ```
  41. ~$ sudo ls
  42. [sudo] password for newuser:
  43. ```
  44.  
  45. If everything is ok, th `ls` should be executed.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement