Dec 18, 2010

create Sudo user (administrator) in Ubuntu Linux

In Linux, we use "sudo" to run a command as administrator  (e.g., sudo  xxx_command).
If you want not to type "sudo" every time, create sudo user or get temporary sudo permission.

(1) create new sudo user 
sudo  useradd  -m  k  -G  admin

in detail,
sudo = run  "useradd" command as administrator 
useradd = command for adding a new user
-m = create home directory for the user
k = account name
-G = set up a group
admin = group name


(2) change current user to sudo user
run  "sudo  gedit  /etc/group"
find something like "admin:x:123:k" where k is current user name
add  ",sj" to change the user to sudo user,  e.g.,  admin:x:123:k,sj


(3) get temporary sudo permission
run  "sudo passwd root"  to set up password for root (skip this if root account already has password)
run  "su -"  or  "su root",  and enter the password
now command prompt changes from $ to # and current account is temporarily sudo user
this sudo permission will be gone when the command terminal/shell is closed.

No comments:

Post a Comment