기본 콘텐츠로 건너뛰기

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:

[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)

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:

[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

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:

[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

[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 ~]#

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…

댓글

이 블로그의 인기 게시물

Ubuntu (Kubuntu) 에 desktop 파일 만들기

Package 관리자등을 통해 직접 Repository 에 있는 Application 을 설치하는 경우에는 필요한 경로와 파일, Category 로 분류된 Icon 등록 등이 자동적으로 이루어지나 firefox, eclipse 등 새로운 버전을 새로 설치할 경우, 다음과 같은 절차를 통해 시작메뉴에 등록시킬 수 있다. 다음은 eclipse-SDK-3.6-linuxx-gtk.tar.gz 을 받아 설치 등록하는 것을 예로 든다. 1. 다운받은 파일을 /usr/lib에 압축해제한다. (물론, super user 계정으로 실행해야 한다.) 2. 보통의 경우, /usr/bin Directory 는 PATH 에 물려 있으므로 다음과 같은 실행 파일을 만들어 놓는다. # cd /usr/lib # chmod +x eclipse # cd /usr/bin # sudo nano eclipse eclipse 파일에는 아래의 내용을 입력하여 넣는다. export ECLIPSE_HOME="/usr/lib/eclipse" $ECLIPSE_HOME/eclipse $ * # sudo chmod 755 eclipse 3. Desktop Menu 에 추가하려면 # cd /usr/share/applications # sudo nano eclipse.desktop [Desktop Entry] Encoding=UTF-8 Name=Eclipse Comment=Eclipse IDE Exec=eclipse Icon=/usr/lib/eclipse/icon.xpm Terminal=false Type=Application Categories=GNOME;Application;Development' StartupNotify=true 이렇게 입력한 파일을 저장하면, 시작메뉴 > 개발 > Eclipse 아이콘이 생성되어 메뉴에서 직접 실행할 수 있게된다.

VIDEO_DXGKRNL_FATAL_ERROR on Windows 8.1

Windows 8.1 로 업데이트 이후, Booting 시 Blue Screen 이 뜨면서, VIDEO_DXGKRNL_FATAL_ERROR 또는 SYSTEM_SERVICE_EXCEPTION (atikmpag.sys)  가 발생하는 문제점이 있을 때, 아래와 같이 조치해 보십시오. 제어판 -> 전원 옵션 -> 설정 변경 덮개를 닫으면 수행되는 작업 선택 -> 현재 사용할 수 없는 설정 변경 -> 종료 설정 -> 빠른 시작 켜기(권장)의 Check Box 를 해제함.

네트워크 상의 IP 주소로 MAC 주소를 추출하는 방법

Subject :  How can I get a list of MAC to IP addresses on the network? An easy way to get a list of MAC to IP addresses on the local subnet is to ping every host on the subnet and then check you ARP cache, however pinging every individual node would take ages and the entries only stay in the ARP cache for 2 minutes. 로컬 서브넷 상의 IP 주소에 대한 MAC 주소 목록을 획득하는 쉬운 방법은 서브넷 상의 모든 호스트에게 Ping 을 하고 ARP(Address Resolution Protocol) 캐쉬를 확인하는 것이다.  그러나, 모든 개별 노드에 Ping 하는 것은 많은 시간이 걸릴 것이고 2분동안만 ARP 캐쉬에 체재하면서 들어갈 수 있다. (참고) ARP 캐쉬는 Linux 의 경우 20분, Windows Server 의 경우 2분이 기본적인 Life Time  이다. 그 이후에는 그 데이타가 지워진다. An alternative is to ping the broadcast mask of your subnet which will ping every host on the local subnet (you can't ping the entire network as you only communicate directly with nodes on the same subnet, all other requests are via the gateway so you would just get a ARP entry for the gateway). 로컬 서브넷상의 모든 호스트를 Ping 하게 될 사용자의 서브넷 브로드캐스트 마스크를 Ping 하는 것이 또 다른 방법이다.(동일 서브넷 상의 노드와 직접적으로