Breaking News
Loading...
Friday, August 9, 2013

How to Add User to root Group on CentOS 6.4/Redhat

9:37 AM

1. Introduction
In this post, i will show you on how to add user to root group on CentOs 6.4. This post assume that you already install the CentOS 6.4 server.
2. Add User to Root Group
Step 1. Add a new user. In this example, I used ‘test’ and then set the password.
[root@CentOS64 ~]# useradd test
[root@CentOS64 ~]# passwd test
Changing password for user test
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
 
Step 2. Check current groups for ‘root’ user.
[root@CentOS64 ~]# groups
root bin daemon sys adm disk wheel
 
Step 3. Add ‘test’ into root group as below: useradd -G {group-name} username
[root@CentOS64 ~]# usermod -G root test
 
Step 4. Switch to ‘testt’ user. Then Check current group for ‘test’. root group will be the second group for ‘test’.
[root@CentOS64 ~]# su - test
[test@CentOS64 ~]$ groups
test root
 
Step 5. Grep the ‘test’ user’s group.
[root@CentOS64 ~]# grep test /etc/group
root:x:0:root,test
test:x:502:
 
Step 6. check the file permission for /etc/passwd
[root@CentOS64 ~]# ls -al /etc/passwd
-rw-r--r-- 1 root root 1026 Jan 21 05:32 /etc/passwd
Explanation : Only the owner which is ‘root’ user can edit the /etc/passwd file, not in the root’s group.

1 comments:

  1. Horoscope des scorpions horoscope verseau juin

    Check out my homepage: voyance gratuite

    ReplyDelete

 
Toggle Footer