[root@fedora ~]# adduser -u 0 -o -g 0 -G 0,1,2,3,4,6,10 -M root2
Adduser command explanations:
| adduser | -u 0 -o | -g 0 | -G 0,1,2,3,4,6,10 | -M | root2 |
| Using Linux adduser command to create a new user account or to update default new user information. | Set the value of user id to 0. | Set the initial group number or name to 0 | Set supplementary group to: 0 = root 1 = bin 2 = daemon 3 = sys 4 = adm 6 = disk 10 = wheel | 'home directory' not created for the user. | User name of the new user account. |
Note: you need to have the administrative privilege on the system in order to issue 'adduser' command above.
4. Now add a password for user ‘root2’ by issue the ‘passwd root2’ command, see example below:
[root@fedora ~]# passwd root2
Changing password for user root2.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
Note: you need to have the administrative privilege on the system in order to issue 'passwd' command above.
5. Check id for user root2 by issue the ‘id root2’ command, see example below:
[root@fedora ~]# id root2
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
6. Now recheck the passwd, shadow and group files that contain ‘root2’ user informations to confirm the changes:
[root@fedora ~]# less /etc/passwd
root:x:0:0:root:/root:/bin/bash
root2:x:0:0::/home/root2:/bin/bash
[root@fedora ~]# less /etc/shadow
root:$1$B2BRWv4X$Gb.MPc6I3RwCkEkT13ow21:13080:0:99999:7:::
root2:$1$bQHGH4cX$TtsV/WVdFe5cIsHWjzc.N1:13112:0:99999:7:::
[root@fedora ~]# less /etc/group
root:x:0:root,root2
bin:x:1:root,bin,daemon,root2
daemon:x:2:root,bin,daemon,root2
sys:x:3:root,bin,adm,root2
adm:x:4:root,adm,daemon,root2
disk:x:6:root,root2
wheel:x:10:root,root2
7. Everything should be ok, now try to login to system with newly created ‘root2’ account, see example:
login as: root2
root2@10.7.0.211's password:
Last login: Thu Nov 24 23:48:49 2005 from 10.7.0.112
Could not chdir to home directory /home/root2: No such file or directory
-bash-3.00#
-bash-3.00#
-bash-3.00# su –
[root@fedora ~]#
8. Make sure that you execute the su command with hyphen ( su - ) to get the PATH of the user that you become to... below is the example of the su command with hyphen and without hyphen.
Loggin in as user tenouk, then execute $PATH as example below.
[tenouk@fedora ~]$ $PATH
-bash: /usr/lib/qt-3.3/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/ tenouk/bin: No such file or directory
[tenouk@tenouk ~]$
Use the su command to change to root user as example below and then execute $PATH as example below.
[tenouk@fedora ~]$ su root
Password:
[root@fedora tenouk]# $PATH
bash: /usr/kerberos/sbin:/usr/lib/qt-3.3/bin:/usr/kerberos/bin:/usr/local/bin:/b in:/usr/bin:/home/tenouk/bin: No such file or directory
[root@fedora tenouk]#
Then try use the su - command and verify with the $PATH as example below.
[root@tenouk tenouk]# su - root
No comments:
Post a Comment