1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > linux用户及用户权限管理 Linux用户用户组及权限管理

linux用户及用户权限管理 Linux用户用户组及权限管理

时间:2019-12-21 05:28:00

相关推荐

linux用户及用户权限管理 Linux用户用户组及权限管理

Linux安全上下文:

运行中的程序:进程

进程所能够访问资源的权限取决于进程的运行者身份

涉及的配置文件

/etc/passwd:保存用户信息

whatis passwd

sslpasswd (1ssl) - compute password hashes

passwd (1) - update user's authentication tokens

passwd (5) - password file

man 5 passwd

name:password:UID:GID:GECOS:directory:shell

The field are as follows:

name This is the user's login name. It should not contain capital letters.

password This is either the encrypted user password, an asterisk (*), or the letter 'x'. (See pwconv(8) for an explanation of 'x'.)

UID The privileged root login account (superuser) has the user ID 0.

GID This is the numeric primary group ID for this user. (Additional groups for the user are defined in the system group file; see

group(5)).

GECOS This field (sometimes called the "comment field") is optional and used only for informational purposes. Usually, it contains

the full username. Some programs (for example, finger(1)) display information from this field.

GECOS stands for "General Electric Comprehensive Operating System", which was renamed to GCOS when GE's large systems division

was sold to Honeywell. Dennis Ritchie has reported: "Sometimes we sent printer output or batch jobs to the GCOS machine. The

gcos field in the password file was a place to stash the information for the $IDENTcard. Not elegant."

directory This is the user's home directory: the initial directory where the user is placed after logging in. The value in this field is

used to set the HOME environment variable.

shell This is the program to run at login (if empty, use /bin/sh). If set to a nonexistent executable, the user will be unable to

login through login(1). The value in this field is used to set the SHELL environment variable.

/etc/shadow:保存用户密码(加密形式)

Each line of this file contains 9 fields, separated by colons (:), in the following order:

login name

It must be a valid account name, which exist on the system.

encrypted password

Refer to crypt(3) for details on how this string is interpreted.

If the password field contains some string that is not a valid result of crypt(3), for instance ! or *, the user will not be able to use

a unix password to log in (but the user may log in the system by other means).

This field may be empty, in which case no passwords are required to authenticate as the specified login name. However, some applications

which read the /etc/shadow file may decide not to permit any access at all if the password field is empty.

A password field which starts with a exclamation mark means that the password is locked. The remaining characters on the line represent

the password field before the password was locked.

date of last password change

The date of the last password change, expressed as the number of days since Jan 1, 1970.

The value 0 has a special meaning, which is that the user should change her pasword the next time she will log in the system.

An empty field means that password aging features are disabled.

minimum password age

The minimum password age is the number of days the user will have to wait before she will be allowed to change her password again.

An empty field and value 0 mean that there are no minimum password age.

maximum password age

The maximum password age is the number of days after which the user will have to change her password.

After this number of days is elapsed, the password may still be valid. The user should be asked to change her password the next time she

will log in.

An empty field means that there are no maximum password age, no password warning period, and no password inactivity period (see below).

If the maximum password age is lower than the minimum password age, the user cannot change her password.

password warning period

The number of days before a password is going to expire (see the maximum password age above) during which the user should be warned.

An empty field and value 0 mean that there are no password warning period.

password inactivity period

The number of days after a password has expired (see the maximum password age above) during which the password should still be accepted

(and the user should update her password during the next login).

After expiration of the password and this expiration period is elapsed, no login is possible using the current user's password. The user

should contact her administrator.

An empty field means that there are no enforcement of an inactivity period.

account expiration date

The date of expiration of the account, expressed as the number of days since Jan 1, 1970.

Note that an account expiration differs from a password expiration. In case of an acount expiration, the user shall not be allowed to

login. In case of a password expiration, the user is not allowed to login using her password.

An empty field means that the account will never expire.

The value 0 should not be used as it is interpreted as either an account with no expiration, or as an expiration on Jan 1, 1970.

reserved field

This field is reserved for future use.

/etc/login.defs:用户属性

#

# Please note that the parameters in this configuration file control the

# behavior of the tools from the shadow-utils component. None of these

# tools uses the PAM mechanism, and the utilities that use PAM (such as the

# passwd command) should therefore be configured elsewhere. Refer to

# /etc/pam.d/system-auth for more information.

#

# *REQUIRED*

# Directory where mailboxes reside, _or_ name of file, relative to the

# home directory. If you _do_ define both, MAIL_DIR takes precedence.

# QMAIL_DIR is for Qmail

#

#QMAIL_DIR Maildir

MAIL_DIR /var/spool/mail

#MAIL_FILE .mail

# Password aging controls:

#

# PASS_MAX_DAYS Maximum number of days a password may be used.

# PASS_MIN_DAYS Minimum number of days allowed between password changes.

# PASS_MIN_LEN Minimum acceptable password length.

# PASS_WARN_AGE Number of days warning given before a password expires.

#

PASS_MAX_DAYS 99999

PASS_MIN_DAYS 0

PASS_MIN_LEN 5

PASS_WARN_AGE 7

#

# Min/max values for automatic uid selection in useradd

#

UID_MIN 1000

UID_MAX 60000

# System accounts

SYS_UID_MIN 201

SYS_UID_MAX 999

#

# Min/max values for automatic gid selection in groupadd

#

GID_MIN 1000

GID_MAX 60000

# System accounts

SYS_GID_MIN 201

SYS_GID_MAX 999

#

# If defined, this command is run when removing a user.

# It should remove any at/cron/print jobs etc. owned by

# the user to be removed (passed as the first argument).

#

#USERDEL_CMD /usr/sbin/userdel_local

#

# If useradd should create home directories for users by default

# On RH systems, we do. This option is overridden with the -m flag on

# useradd command line.

#

CREATE_HOME yes

# The permission mask is initialized to this value. If not specified,

# the permission mask will be initialized to 022.

UMASK 077

# This enables userdel to remove user groups if no members exist.

#

USERGROUPS_ENAB yes

# Use SHA512 to encrypt password.

ENCRYPT_METHOD SHA512

/etc/defaults/useradd:默认的useradd配置文件

# useradd defaults file

GROUP=100

HOME=/home

INACTIVE=-1

EXPIRE=

SHELL=/bin/bash

SKEL=/etc/skel

CREATE_MAIL_SPOOL=yes

/etc/group

The /etc/group file is a text file that defines the groups on the system. There is one entry per line, with the following format:

group_name:password:GID:user_list

The fields are as follows:

group_name the name of the group.

password the (encrypted) group password. If this field is empty, no password is needed.

GID the numeric group ID.

user_list a list of the usernames that are members of this group, separated by commas.

/etc/gshadow

新建用户之后,系统默认进行的操作

标签:权限,group,用户组,should,field,user,Linux,login,password

来源: /hjmLinux/p/11688568.html

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。