Introduction to Linux system users and user groups

Source: Internet
Author: User

1. What is the principle and solution of the following login environment failure?

1[[email protected] test]#useradd RR # #创建用户rr2[[email protected] test]#ID RR3uid=510 (RR) gid=511 (RR) groups=511(RR)4[[Email protected] ~]#ls-la/home/rr/# #查看 What files are in the/HOME/RR directory5Total 286DRWX------2 RR RR 4096 Dec 26 09:41 .7Drwxr-xr-x. Root root 4096 Dec 26 09:41 ..8-rw-r--r--1 RR RR 24 02:55. Bash_logout9-rw-r--r--1 RR RR 176 Jul 24 02:55. Bash_profileTen-rw-r--r--1 RR RR 124 Jul 24 02:55. BASHRC One-rw-r--r--1 RR RR 658 Nov 10 20:27. ZSHRC A-rw-r--r--1 RR RR 25 11:03Readme.txt -[[Email protected] ~]#CD/HOME/RR -[[email protected] RR]#rm-f. Bash the . bash_history. bash_logout. Bash_profile. BASHRC -[[email protected] RR]#rm-f. bash* # #将目录下以bash开头的文件删除 -[[Email protected] ~]#SU-RR # #切换到rr账户 --bash-4.1$##登录环境故障 + ##处理办法 --bash-4.1$ cp/etc/skel/.bash*/HOME/RR##将 The/etc/skel directory, copy the bash file to the user account directory where the file is missing. +-bash-4.1$ logout A[[Email protected] ~]#SU-RR # #重新切换到rr账号成功 at[Email protected] ~]$

1 ## 2 [[email protected]/home 09:56:56]#ps1= ' [\[email protected]\h \w \t]\$ ' # #如果想让配置永久生效, can be written to the/etc/profile file

2. Understanding the meaning of/etc/login.efs specific parameters

1 #*required*2 #Directory where mailboxes reside, _or_ name of file, R3 elative to the4 #home directory. If you _do_ define both, Mail_dir Tak5 es Precedence.6 #Qmail_dir is for QMAIL7 #8 #Qmail_dir Maildir9Mail_dir/var/spool/mail##mail邮箱路径Ten #mail_file. MAIL One #Password Aging Controls: A # - #pass_max_days Maximum number of days a PASSW - ord may used. the #pass_min_days Minimum number of days allowed - between password changes. - #pass_min_len Minimum acceptable password Le - ngth. + #Pass_warn_age number of days warning given b - efore a password expires. + # APass_max_days 99999##密码有效期最大的天数 atPass_min_days 0##最小有效期 -Pass_min_len 5##密码最小长度 -Pass_warn_age 7##过期的警告 -  - #Min/max values for automatic uid selection in Userad - D in # -Uid_min 500 toUid_max 60000##用户ID的大小 +  - # the #Min/max values for automatic gid selection in Groupa * DD $ #Panax NotoginsengGid_min 500 -Gid_max 60000##组ID的大小 the  + #If Useradd should create home directories for users A by default the #On RH Systems, we do. This option was overridden with +The-m Flag on - #useradd command line. $ # $Create_home Yes##是否创建家目录, created by default, can be controlled by the-m parameter -  - #The permission mask is initialized to this value. If the   notspecified, - #The permission mask is initialized to 022.WuyiUMASK 077##家目录的UMASK the  - #This enables Userdel to remove user groups if no mem Wu bers exist. - # AboutUsergroups_enab Yes##删除用户同时删除用户组

3. Master the information in the/etc/default/useradd configuration file;

1[[Email protected] ~]#Cat/etc/default/useradd2 #useradd defaults file3group=1004Home=/home##把用户的家目录建在/home. 5Inactive=-1##是否启用账号过期提权, 1 means not enabled6Expire=##账号终止日期, do not set indicates not enabled7Shell=/bin/bash##新用户默认所用的shell类型8Skel=/etc/skel##配置新用户家目录的默认文件存放路径. The/etc/skel mentioned earlier, that is, when we add a user with Useradd, the files in the user's home directory are copied from the directory configured here.9Create_mail_spool=yes##创建mail文件

Instance:

Useradd-c,-u,-G,-S,-D multiple parameter combinations examples

Customize user's home directory, shell type, user group belonging to, etc.

Add user Oldboy6 and set its user comment information to handsomeboy,uid specified as 806, attribution to user group root, Oldboy, SA member

Its shell type is/bin/sh and the home directory is set to/oldboy6.

The actual operation result is:

1 ## #首先创建用户组sa2[[Email protected] ~]#grep "sa"/etc/group3vcsa:x:69:4saslauth:x:76:5sa:x:512:6[[Email protected] ~]#grep-o "\bsa\b"/etc/group # #只过滤以 The individual words beginning with "sa"7 SA8[[Email protected] ~]#useradd-c "Handsomeboy"-u 806-g root,oldboy,sa-s/bin/sh-d /oldboy6 oldboy69 ##注释Ten-C: Set Note information One-u: set UID number A-G: Set for the genus Group --s: set the corresponding shell --D: Set the appropriate home directory the ## #成果如下 -[[Email protected] ~]#grep "Oldboy6"/etc/passwd -oldboy6:x:806:806:handsomeboy:/oldboy6:/bin/SH -[[Email protected] ~]#ID oldboy6 +uid=806 (OLDBOY6) gid=806 (oldboy6) groups=806 (Oldboy6), 0 (Root), (SA), 513 (Oldboy)

Introduction to Linux system users and user groups

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.