Ordinary users have ROOT privileges

vi etc/passwd

sam:x:200:50:Samsan:/usr/sam:/bin/sh

 

Modify 200 to 0, then the sam user has root privileges.

 

etc/passwd file description (from: http://blog.sina.com.cn/s/blog_b91dcf1c01019xa4.html)

A line of records in etc/passwd corresponds to a user, and each line of records is separated into 7 fields by colons (the format and specific meaning are as follows: Username: Password: User ID: Group ID: Commentary Description: Home Directory : Login Shell
Example:
root:x:0:0:Superuser:/:
daemon:x:1:1:Systemdaemons:/etc:
bin:x:2:2:Ownerofsystemcommands:/bin:
sys:x:3:3 :Ownerofsystemfiles:/usr/sys:
adm:x:4:4:Systemaccounting:/usr/adm:
uucp:x:5:5:UUCPadministrator:/usr/lib/uucp:
auth:x:7:21:Authenticationadministrator: /tcb/files/auth:
cron:x:9:16:Crondaemon:/usr/spool/cron:
listen:x:37:4:Networkdaemon:/usr/net/nls:
lp:x:71:18:Printeradministrator :/usr/spool/lp:
sam:x:200:50:Samsan:/usr/sam:/bin/sh
From the above example, we can see that a line of records in /etc/passwd corresponds to a user, and each line The record is separated into 7 fields by colon (:), and its format and specific meaning are as follows:
Username: Password: User ID: Group ID: Commentary Description: Home Directory: Login Shell
"Username" is a string representing the user's account number. Usually no more than 8 characters in length and consists of upper and lower case letters and/or numbers. There cannot be a colon (:) in the login name because the colon is the delimiter here. For compatibility, it is best not to include the dot character (.) in the login name, and not to start it with a hyphen (-) or a plus sign (+).

"Password" In some systems, encrypted user passwords are stored. Although this field stores only the encrypted string of the user's password, not plaintext, it is still a security risk because the /etc/passwd file is readable by all users. Therefore, many Linux systems (such as SVR4) now use shadow technology to store the real encrypted user password in the /etc/shadow file, and only store a special password field in the /etc/passwd file. characters, such as "x" or "*".

The "User ID" is an integer that is used internally by the system to identify the user. In general, it corresponds to the user name one-to-one. If the user identification numbers corresponding to several user names are the same, the system will treat them as the same user, but they can have different passwords, different home directories, and different login shells.
Usually, the value range of the user identification number is 0 to 65535. 0 is the identification number of the super user root, and 1 to 99 are reserved by the system. As the management account, the identification number of ordinary users starts from 100. On Linux systems, this limit is 500.

The "Group ID" field records the user group to which the user belongs. It corresponds to a record in the /etc/group file.

The "annotative description" field records some personal information of the user, such as the user's real name, phone number, address, etc. This field has no practical use. In different Linux systems, the format of this field is not uniform. On many Linux systems, this field holds an arbitrary annotative description text that is used as the output of the finger command.
The "home directory", which is the user's starting working directory, is the directory the user is in after logging into the system. In most systems, each user's home directory is organized in a specific directory, and the name of the user's home directory is the user's login name. Each user has read, write, execute (search) permissions on their own home directory, and the access permissions of other users to this directory are set according to specific conditions.

After the user logs in, a process needs to be started, which is responsible for passing the user's operation to the kernel. This process is the command interpreter or a specific program that runs after the user logs in to the system, that is, the Shell. Shell is the interface between the user and the Linux system. There are many kinds of Linux shells, each with different characteristics. Commonly used are sh (BourneShell), csh (CShell), ksh (KornShell), tcsh (TENEX/TOPS- 20typeCShell), bash (BourneAgainShell) and so on. System administrators can specify a certain Shell for users according to system conditions and user habits. If no Shell is specified, the system uses sh as the default login shell, that is, the value of this field is /bin/sh.
The user's login shell can also be specified as a specific program (this program is not a command interpreter). Using this feature, we can restrict the user to run only the specified application, and the user will automatically log out of the system after the application is finished running. Some Linux systems require that only those programs registered in the system appear in this field.

系统中有一类用户称为伪用户(psuedousers),这些用户在Linux /etc/passwd文件中也占有一条记录,但是不能登录,因为它们的登录Shell为空。它们的存在主要是方便系统管理,满足相应的系统进程对文件属主的要求。常见的伪用户如下所示。
伪用户含义
bin拥有可执行的用户命令文件
sys拥有系统文件
adm拥有帐户文件
uucpUUCP使用
lplp或lpd子系统使用
nobodyNFS使用
拥有帐户文件
除了上面列出的伪用户外,还有许多标准的伪用户,例如:audit,cron,mail,usenet等,它们也都各自为相关的进程和文件所需要。
由 于Linux /etc/passwd文件是所有用户都可读的,如果用户的密码太简单或规律比较明显的话,一台普通的计算机就能够很容易地将它破解,因此对安全性要求较 高的Linux系统都把加密后的口令字分离出来,单独存放在一个文件中,这个文件是/etc/shadow文件。只有超级用户才拥有该文件读权限,这就保 证了用户密码的安全性。

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326927843&siteId=291194637