|
|
Line 1: |
Line 1: |
| '''Create extra root user account to your Linux box.''' | | '''Create extra root user account to your Linux box.''' |
− |
| |
− |
| |
− |
| |
− | The ‘root’ account with user id 0 is the most powerful user in Linux and Unix system. This article show the step by step to create the duplicate root account that have the same privileges as super user root account on the Linux Fedora Core operating system.
| |
− |
| |
− |
| |
− |
| |
− | You may want to make replicate of root user account, or to create more than one user account that have the same capabilities as a 'root' user (superuser) account. Why, may be for a root backup user account, incase of something happen to the 'root' user account or may be just for fun :-).
| |
− |
| |
− |
| |
− |
| |
− | To create another root user account, we need to replicate the 'root' user account characteristic, then make one account that have the same characteristic and capabilities of the 'root' user account.
| |
− |
| |
− |
| |
− | Let begin by check the 'root' user account.
| |
− |
| |
− |
| |
− |
| |
− | 1. Check user id for ‘root’ user account:
| |
− |
| |
− | <pre>
| |
− |
| |
− | [root@fedora ~]# id root
| |
− |
| |
− | uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
| |
− |
| |
− | </pre>
| |
− |
| |
− | Explanations of the command output:
| |
− |
| |
− | A. uid=0(root) The user id for user 'root' user is 0.
| |
− |
| |
− | B. gid=0(root) the group id for user ‘root’ is 0.
| |
− |
| |
− | C. groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel) The user ‘root’ is belong in groups; root, bin, daemon, sys, adm, disk and wheel.
| |
− |
| |
− |
| |
− |
| |
− | 2. Now we take a look at the passwd, shadow and group files that contain ‘root’ user information:
| |
| <pre> | | <pre> |
− |
| + | [root@fedora ~]# adduser -u 0 -o -g 0 -G 0,1,2,3,4,6,10 -M root2 |
− | | |
− | [root@fedora ~]# less /etc/passwd
| |
− | | |
− | root:x:0:0:root:/root:/bin/bash
| |
− | | |
− | [root@fedora ~]# less /etc/shadow
| |
− | | |
− | root:$1$B2BEWv4X$Gb.QPb6I3RwCkEkz13ow21:13080:0:99999:7:::
| |
− | | |
− | [root@fedora ~]# less /etc/group
| |
− | | |
− | root:x:0:root
| |
− | | |
− | bin:x:1:root,bin,daemon
| |
− | | |
− | daemon:x:2:root,bin,daemon
| |
− | | |
− | sys:x:3:root,bin,adm
| |
− | | |
− | adm:x:4:root,adm,daemon
| |
− | | |
− | tdisk:x:6:root
| |
− | | |
− | wheel:x:10:root
| |
− | | |
− | </pre>
| |
− | | |
− | From the information gather above, to create a user that have the same power (superuser power) as a ‘root’ user in Linux system, we need to create a user with same root user uid, gid and group.
| |
− | | |
− |
| |
− | | |
− | 3. To create user account that has the same ability (super user) as the ‘root’ user, issue this command:
| |
− | | |
− | <pre>
| |
− | | |
− | [root@fedora ~]# adduser -u 0 -o -g 0 -G 0,1,2,3,4,6,10 -M root2 | |
− | | |
− | </pre>
| |
− | | |
− | 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:
| |
− | | |
− | <pre>
| |
− | | |
| [root@fedora ~]# passwd root2 | | [root@fedora ~]# passwd root2 |
| | | |
Line 148: |
Line 10: |
| Retype new UNIX password: | | Retype new UNIX password: |
| | | |
− | passwd: all authentication tokens updated successfully. | + | passwd: all authentication tokens updated successfully. |
− | </pre>
| |
− |
| |
− | | |
− | 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:
| |
− | | |
− | <pre>
| |
− | | |
| [root@fedora ~]# id root2 | | [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) | | uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel) |
− |
| |
− |
| |
− | </pre>
| |
− | 6. Now recheck the passwd, shadow and group files that contain ‘root2’ user informations to confirm the changes:
| |
− |
| |
− | <pre>
| |
− |
| |
− | [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@fedora ~]# less /etc/group |
| | | |
Line 201: |
Line 28: |
| | | |
| wheel:x:10:root,root2 | | wheel:x:10:root,root2 |
− |
| |
− | </pre>
| |
− |
| |
− | 7. Everything should be ok, now try to login to system with newly created ‘root2’ account, see example:
| |
− |
| |
− | <pre>
| |
− |
| |
| login as: root2 | | login as: root2 |
| | | |
Line 222: |
Line 42: |
| -bash-3.00# su – | | -bash-3.00# su – |
| | | |
− | [root@fedora ~]# | + | [root@fedora ~]# |
− | | |
− | </pre>
| |
− | | |
− | 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.
| |
− | | |
− | <pre>
| |
− | | |
− | [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 ~]$
| |
− | | |
− | </pre>
| |
− | | |
− | Use the su command to change to root user as example below and then execute $PATH as example below.
| |
− | | |
− | <pre>
| |
− | | |
− | [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]#
| |
− | </pre>
| |
− |
| |
− | | |
− | Then try use the su - command and verify with the $PATH as example below.
| |
− | | |
− |
| |
| <pre> | | <pre> |
− | [root@tenouk tenouk]# su - root
| |
− |
| |
− | [root@tenouk ~]# $PATH
| |
− |
| |
− | -bash: /usr/lib/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin: /usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin: No such file or director y
| |
− |
| |
− | [root@tenouk ~]#
| |
− |
| |
− | </pre>
| |
− |
| |
− | Note: The execution of su command, without the hypen ( - ) you inherit the PATH of the current user. Use the su command, with hyphen ( su - ) to get the default PATH of the root user.
| |
− |
| |
− |
| |
− |
| |
− | Step-by-step how to procedure above tested on:
| |
− |
| |
− | Operating System: GNU/Linux Fedora Core 4
| |
− |
| |
− | Kernel Name: Linux
| |
− |
| |
− | Kernel Release: 2.6.11-1.1369_FC4
| |
− |
| |
− | Kernel Version: #1 Thu Jun 2 22:55:56 EDT 2005
| |
− |
| |
− | Machine Hardware: i686
| |
− |
| |
− | Machine Processor: i686
| |
− |
| |
− | Hardware Platform: i386
| |
− |
| |
− | Shell: GNU bash, version 3.00.16(1)-release (i386-redhat-linux-gnu)
| |
− |
| |
− | Installation Type: Full Installation (Custom)
| |
− |
| |
− | SELinux: Disable
| |
− |
| |
− |
| |
− |
| |
− | Keywords: root user, create root user account, add root user, create root user, adding root user account, root user account, add root user account.
| |
− |
| |
− | Good Nite... & Good luck…
| |
− |
| |
| ---------------------------------------------------------- | | ---------------------------------------------------------- |
| | | |
| [http://www.labtestproject.com/create_root_user_account Source] | | [http://www.labtestproject.com/create_root_user_account Source] |