To create a user in RHEL 6 we can use commands as well as graphical user administration tools. It is advisable to use command line as much as possible because it is faster and in real business environment you have to use ssh to remotely take control to administer the system.
- To create a user run command:
- useradd user_name
- To define a password for the user:
- passwd user_name
- Create a user with specific UID:
- useradd -u 802 user_name
- The above command will create a user with UID 802.
- To create a group run command:
- groupadd group_name
- To delete a user run command:
- userdel user_name
- The above command will delete the user but it will not delete the home directory of user. To delete the home directory as well as the files contained in it run following command"
- userdel -r user_name
User and Group Administration |
Given below are some sample questions about user and group administration:
Q1. Create a user rambo and make it a member of group student.
Ans. useradd -G student rambo.
To see the results view /etc/passwd and /etc /group files.
Q2. Create a user sheela with UID 566 and assign it no interactive shell.
Ans. useradd -s /bin/false sheela
The above command will add a user sheela, and give it non interactive shell.
Q3. Make the user munni to expire on date 17-09-2011.
Ans. chage -E 2011-09-17 munni
The above command will make the account of user munni unavailable from 17-09-2011
Q4. User pandeyg have to change password at the time of next login.
Ans. chage -d 0 pandeyg
The above command will force user to change password when the user tries to login.
No comments:
Post a Comment