Welcome everyone to my blog, first of all declare this article is my * * *, if the text is inappropriate, but also please the predecessors of the great God a lot of advice, niche here first thanked. Life always has all kinds of unhappy, for me the immediate is the best arrangement; to be honest, I don't really like software. This major, I am a liberal arts man, the software world of troughs for me to walk really some difficulty, came to the university inexplicably into this profession, became it the sea a small stone. There is no way, improvise clear, only a head-on to show my generation spirit AH; graduated from university I this small stone quirks contact with the software operation and maintenance of the industry, with a full of confidence with a bright future I joined the Army of Linux training. It was not just two weeks of study and I started my first blog post in my life. Well, the big home and I this child shoes to understand Linux users and Rights Management!
First, Linux users can be divided into the following areas:
User:
A user is a collection of permissions that can obtain system resources.
Linux User Group categories:
(1) Administrator root: Users who use all the privileges of the system, (UID 0)
(2) Ordinary users: that is, the general user, the specific use of restricted access; (UID 1-65635)
(3) System users: Protect the system operation of the user, the General people without password can not login. (UID is 1-499)
User groups
User group Categories:
(1) Normal user group: can add multiple users
(2) System user group: Add only some system users
(3) Private group (that is, basic group): When the user is created, if the owning group is not specified for it, a private user group is defined for it, with the name of the user group; (Note: Private groups can become normal user groups, and when other users are added to the group, they become normal groups)
Groups are containers for permissions
For example, a normal user can inherit the permissions of the group to which it belongs.
Files related to the group:/etc/group,/etc/gshadow
/etc/group File: its format: group_name:passwoerd:GID:user_list
Group_name: Group Name
Passwoerd: Group Password
GID: ID number of the group
User_list: List of users with group_name as additional groups
6. User-related files/etc/passwd,/etc/shadow
A /etc/passwd file:
Its format: Account:password:UID:GID:GECOS:diretory:shell
Account: Username or username
Password: User password placeholder
UID: ID number of the user
GID: ID number of the group in which the user is located
GECOS: Details of the user (e.g. name, age, telephone, etc.)
Diretory: User's home directory
Shell: The programming environment in which the user resides
b /etc/shadow
Its format: Account:password: The date of the most recent password change: The number of days the password cannot be changed: the number of days the password needs to be re-modified: The warning period before the password change: grace period for password expiration: Account expiration Date: Reserved.
7. Modify the user and user group commands: useradd,usermod, Groupdd,userdel
A Add User: Useradd [options] Username
Options
1. -u:uid
2. -g:gid
3. -D: Specify user home directory, default is/home/username
4. -S: Specifies the shell environment in which the user resides
5. -G: Specify additional groups for users
For example, add a user maedu. UID is 1234 directories/home/oracle,shell to/bin/sh
#useradd –u 1234–d/home/oracle–s/bin/sh maedu
b Modify User: Usermod [options] Username
Options
1. -u:uid
2. -g:gid
3. -D: Specify user home directory, default is/home/username
-M together with-B to remove the contents of the user's home directory
4. -S: Specifies the shell environment in which the user resides
5. -G: Specify additional groups for users
For example, modify the user maedu uid to 1000 home directory/oracle,shell for/bin/bash
#usermod –u 1000–d/oracle–s/bin/bash-m maedu
C Add user group: Groupadd [Options] GroupName
Options
1. -g:gid
For example, add the user group GRP uid to 1010 #groupadd –g 1010 GRP
D Delete User: Userdel [options]username
Options
1. -R: Delete together with home directory
For example, delete user maedu and home directory
#userdel –r maedu
8. How to get administrator privileges for Linux ordinary users
(1) Add a user, first with the AddUser command to add a normal user, the command is as follows:
#adduser Tommy </p> <p>//Add a user named student
#passwd Student//Change Password
changing password for User student.
new UNIX Password://Enter a new password here
Retype new UNIX Password://Enter password again
Passwd:all Authentication Tokens Updated successfully
(2) giving root privileges
A. Modify the/etc/sudoers file, find the following line, remove the previous comment (#)
# # allows people in group wheel to run all commands
%wheel all= (All) all
B. Then modify the user to belong to the root group (wheel) with the following command:
#usermod-G root Student
C. Modified, you can now log in with the Tommy account, and then use the command Su-, you can get root permissions to operate.
The above is my understanding of Linux users and their rights and collation, if there are improper welcome to correct!
This article is from the "11253644" blog, please be sure to keep this source http://11263644.blog.51cto.com/11253644/1749556
User and Rights Management for Linux