Linux sudo - Part 2
Install sudo (substitute user do)
If you have used Ubuntu, you might be familiar with sudo. It allows users to run programs with privileges of another user (normally a superuser). Using sudo, a user needn’t login as a root. He can rent that privilege using the sudo command to perform privileged tasks. To install sudo in ArchLinux:
#pacman -Syu sudo
Use appropriate package manager depending upon your distribution. In Archlinux, pacman is the default package manager.
Now I needn’t use the system as root. So I create a account for myself.
Add a new user account
To create a new user account use adduser program:
Options: -d home directory -s starting program (shell) -p password -g (primary group assigned to the users) -G (Other groups the user belongs to) -m (Create the user’s home directory
[root@myhost ~]# useradd -d/home/onie -m onie
Modify or add password To add a password to a user account use passwd command.
[root@myhost ~]# passwd onie Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully
Switch to another user account
To switch to another user, we use the su command. This is most commonly used to switch to the root account.
Example: To switch to root account
su
(When asked for password enter root’s password)
Example: To switch to the user ‘onie’
su onie
(Enter onie’s password) To return to original user, enter exit
Modifying existing user accounts
To modify a user account we use usermod command. Options: -d home directory -s starting program (shell) -p password -g (primary group assigned to the users) -G (Other groups the user belongs to)
Deleting a user account
To delete user account we use userdel command. Options: -r (remove home directory)
To know more about group/user creation and modification: User and Groups Tutorial
To continue to SUDO configuration : SUDO tutorial Sudo article from Archwiki pages: Sudo