Guest User

Untitled

a guest
Jul 22nd, 2018
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. // Log in to your server as the root user.
  2.  
  3. local$ ssh root@server_ip_address
  4.  
  5. //Use the adduser command to add a new user to your system.
  6.  
  7. // Be sure to replace username with the user that you want to create.
  8.  
  9. adduser username
  10.  
  11. // Set and confirm the new user's password at the prompt. A strong password is highly recommended!
  12.  
  13. Set password prompts:
  14. Enter new UNIX password:
  15. Retype new UNIX password:
  16. passwd: password updated successfully
  17. Follow the prompts to set the new user's information. It is fine to accept the defaults to leave all of this information blank.
  18.  
  19. User information prompts:
  20. Changing the user information for username
  21. Enter the new value, or press ENTER for the default
  22. Full Name []:
  23. Room Number []:
  24. Work Phone []:
  25. Home Phone []:
  26. Other []:
  27. Is the information correct? [Y/n]
  28. Use the usermod command to add the user to the sudo group.
  29.  
  30. usermod -aG sudo username
  31.  
  32. // By default, on Ubuntu, members of the sudo group have sudo privileges.
  33.  
  34. //Test sudo access on new user account
  35.  
  36. Use the su command to switch to the new user account.
  37.  
  38. # su - username
  39.  
  40. // As the new user, verify that you can use sudo by prepending "sudo" to the command that you want to run with superuser privileges.
  41.  
  42. username$ sudo command_to_run
  43.  
  44. //For example, you can list the contents of the /root directory, which is normally only accessible to the root user.
  45.  
  46. username$ sudo ls -la /root
  47.  
  48. //The first time you use sudo in a session, you will be prompted for the password of the user account. Enter the password to proceed.
  49.  
  50. Output:
  51. [sudo] password for username:
  52. If your user is in the proper group and you entered the password correctly, the command that you issued with sudo should run with root privileges.
Add Comment
Please, Sign In to add comment