Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Create Users and Manage Their Sudo Privileges on Ubuntu
- To demonstrate, I use the `newuser` as user name
- ### Add a new user with `adduser`
- ```bash
- # adduser newuser
- Adding user `newuser' ...
- Adding new group `newuser' (1001) ...
- Adding new user `newuser' (1001) with group `newuser' ...
- Creating home directory `/home/newuser' ...
- Copying files from `/etc/skel' ...
- Enter new UNIX password:
- Retype new UNIX password:
- passwd: password updated successfully
- Changing the user information for newuser
- Enter the new value, or press ENTER for the default
- Full Name []: New User
- Room Number []: 101
- Work Phone []: 123456
- Home Phone []: 123456
- Other []:
- Is the information correct? [Y/n] y
- ```
- ### Add sudo privileges with `usermod`
- ```bash
- # usermod -aG sudo newuser
- ```
- ### Switch to the new account with `su`
- ```bash
- # su - newuser
- ```
- After this command, you should be login with the new account
- ### Test it with a `sudo` command
- ```
- ~$ sudo ls
- [sudo] password for newuser:
- ```
- If everything is ok, th `ls` should be executed.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement