Linux User Management related

Source: Internet
Author: User

650) this.width=650; "src=" Https://s1.51cto.com/oss/201711/18/8c61ded0561a8f6508675e1a52dcb52e.png "title=" 1.png " Width= "680" height= "244" border= "0" hspace= "0" vspace= "0" style= "width:680px;height:244px;" alt= " 8c61ded0561a8f6508675e1a52dcb52e.png "/>


Four files associated with a user

/etc/passwd

/etc/shadow

/etc/group

/etc/gshadow


650) this.width=650; "src=" Https://s1.51cto.com/oss/201711/18/3a5a829111c40d1565f4dcc30f4a82bd.png "title=" 2.png " Width= "680" height= "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:680px;height:110px; "alt=" 3a5a829111c40d1565f4dcc30f4a82bd.png "/>

650) this.width=650; "src=" Https://s3.51cto.com/oss/201711/18/b842430e369649b7eb43015515c788db.png "title=" 3.png " Width= "680" height= "135" border= "0" hspace= "0" vspace= "0" style= "width:680px;height:135px;" alt= " B842430e369649b7eb43015515c788db.png "/>

650) this.width=650; "src=" Https://s3.51cto.com/oss/201711/18/8905c977dcdcf2e95c0d459db1277933.png "title=" 5.png " Width= "680" height= "165" border= "0" hspace= "0" vspace= "0" style= "width:680px;height:165px;" alt= " 8905c977dcdcf2e95c0d459db1277933.png "/>



650) this.width=650; "src=" Https://s5.51cto.com/oss/201711/18/921cca885ef34aa2b97f67228bf271cc.png "style=" width : 680px;height:193px; "title=" 111.png "width=" 680 "height=" 193 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" 921cca885ef34aa2b97f67228bf271cc.png "/>


650) this.width=650; "src=" Https://s5.51cto.com/oss/201711/18/86c599b8da1b852dbcb70b827a6207a8.png "title=" Qq20171118205851.png "width=" 666 "height=" "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:666px;height:300px; "alt = "86c599b8da1b852dbcb70b827a6207a8.png"/>

Look at the simulation:

650) this.width=650; "src=" Https://s4.51cto.com/oss/201711/18/956d8bf302477da49003f87ab91c305e.png "title=" 1111. PNG "width=" 680 "height=" 244 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:680px;height:244px; "alt=" 956d8bf302477da49003f87ab91c305e.png "/>

Already in the user's home directory.

Try again, command aliases

originally this user grep did not define a command alias

650) this.width=650; "Src=" Https://s1.51cto.com/oss/201711/18/30c36e48409ae0d882b2eb39d7c9851c.png-wh_500x0-wm_3 -wmp_4-s_3733803290.png "style=" Float:none; "title=" A.png "alt=" 30c36e48409ae0d882b2eb39d7c9851c.png-wh_ "/>

Now let's modify the. Bash_profile file to see if the new user will copy the past

650) this.width=650; "Src=" Https://s1.51cto.com/oss/201711/18/ef4d29650cbc762640d539d9c673b3fd.png-wh_500x0-wm_3 -wmp_4-s_2870072451.png "style=" Float:none; "title=" B.png "alt=" Ef4d29650cbc762640d539d9c673b3fd.png-wh_ "/>

650) this.width=650; "Src=" Https://s1.51cto.com/oss/201711/18/56c45dca5f07691cc39b20923c6b7d5e.png-wh_500x0-wm_3 -wmp_4-s_3854246241.png "style=" Float:none; "title=" C.png "alt=" 56c45dca5f07691cc39b20923c6b7d5e.png-wh_ "/>

650) this.width=650; "Src=" Https://s1.51cto.com/oss/201711/18/3e97cc53f41b49a175d653748a6cfb80.png-wh_500x0-wm_3 -wmp_4-s_23974203.png "style=" Float:none; "title=" D.png "alt=" 3e97cc53f41b49a175d653748a6cfb80.png-wh_ "/>

Delete the original first, indicating that a process is in use,kill off

650) this.width=650; "Src=" Https://s1.51cto.com/oss/201711/18/081eda2a22f4833ce15918c3fb278029.png-wh_500x0-wm_3 -wmp_4-s_2465039048.png "style=" Float:none; "title=" E.png "alt=" 081eda2a22f4833ce15918c3fb278029.png-wh_ "/>

new, and then with grep, there's a color display

650) this.width=650; "Src=" Https://s4.51cto.com/oss/201711/18/5d53038b812956c3b5b64d9db0991096.png-wh_500x0-wm_3 -wmp_4-s_2390444406.png "style=" Float:none; "title=" F.png "alt=" 5d53038b812956c3b5b64d9db0991096.png-wh_ "/>

Summarize the role of Skel:

1, you can put the content of the notice to Skel, let the person who log in to see

2. Unified initialization of new user environment variables

3. Interview questions: Causes of-bash-4.1$ problems and solutions


-bash-4.1$ Home directory environment variables are gone.

650) this.width=650; "src=" Https://s5.51cto.com/oss/201711/18/99972209f977038f7db0b28e5dc305e6.png "title=" 4444. PNG "alt=" 99972209f977038f7db0b28e5dc305e6.png "/>


650) this.width=650; "src=" Https://s1.51cto.com/oss/201711/18/bd2ff183aa6f641b64103e76b51bb7bd.png "title=" 4343434.png "width=" 680 "height=" 273 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:680px;height:273px; "alt=" Bd2ff183aa6f641b64103e76b51bb7bd.png "/>

Understand the next


[Email protected] ~ 22:04:59] #cat/etc/login.defs

UMASK 077

Directory Permissions 777-077 700 permissions


650) this.width=650; "src=" Https://s4.51cto.com/oss/201711/18/0e67ee1f57e40a19e453f3c63e433b73.png "title=" 55555. PNG "width=" 680 "height=" 271 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:680px;height:271px; "alt=" 0e67ee1f57e40a19e453f3c63e433b73.png "/>

650) this.width=650; "src=" Https://s3.51cto.com/oss/201711/18/fc4afabc801b45cbbb928860416607ff.png "title=" q1.png "alt=" Fc4afabc801b45cbbb928860416607ff.png "/>

Changed the default Shell to tcsh .

Add new users, the default is the Tcsh .

650) this.width=650; "src=" Https://s5.51cto.com/oss/201711/18/334e708b6ac2dcf4d37e3b80fa4d1f6f.png "style=" float: none; "title=" Q2.png "alt=" 334e708b6ac2dcf4d37e3b80fa4d1f6f.png "/>

650) this.width=650; "src=" Https://s4.51cto.com/oss/201711/18/cfb4eda2a0cfc3358060cb4380290fb4.png "style=" float: none; "title=" Q3.png "alt=" Cfb4eda2a0cfc3358060cb4380290fb4.png "/>

You can also change this:

650) this.width=650; "src=" Https://s1.51cto.com/oss/201711/18/9c1f7fbf32be7fc9e4438cd6aea2d97c.png "title=" includes. png "alt=" 9c1f7fbf32be7fc9e4438cd6aea2d97c.png "/>

650) this.width=650; "src=" Https://s1.51cto.com/oss/201711/18/86b67ed5d34be083760947f66eea9e2b.png "style=" width : 680px;height:374px; "title=" Q7.png "width=" 680 "height=" 374 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" 86b67ed5d34be083760947f66eea9e2b.png "/>

650) this.width=650; "src=" Https://s1.51cto.com/oss/201711/18/cdd42bd80914aa9709907a46821ef81a.png "style=" width : 680px;height:56px; "title=" Q8.png "width=" 680 "height=" "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" Cdd42bd80914aa9709907a46821ef81a.png "/>

650) this.width=650; "src=" Https://s1.51cto.com/oss/201711/18/a2e9c05c05c09bb7bceeab2f93f4ec4b.png "style=" width : 680px;height:104px; "title=" Q9.png "width=" 680 "height=" 104 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" A2e9c05c05c09bb7bceeab2f93f4ec4b.png "/>

650) this.width=650; "src=" Https://s2.51cto.com/oss/201711/18/e06baf3ed131187925b840a4e3a8d4a5.png "style=" width : 680px;height:120px; "title=" Q10.png "width=" 680 "height=" + "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" E06baf3ed131187925b840a4e3a8d4a5.png "/>

Instance:

Customize user's home directory, shell type, user group to which they belong, etc.

Add user Test90, and set its user comments to Hell Linux,uid specified as 888, belong to the user group ROOT,TEST80,TEST70 members, its shell is/bin/sh, set home directory for/TEST90

650) this.width=650; "src=" Https://s2.51cto.com/oss/201711/18/155bc41b7bd4a77cd030b2786b8213be.png "title=" Erer.png "width=" "height=" 133 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:700px;height:133px; "alt=" 155bc41b7bd4a77cd030b2786b8213be.png "/>

Groupadd

Documents related to it

/etc/group user group related files

/etc/gshadow user group encryption related files

-G xx Specify GID

650) this.width=650; "src=" Https://s5.51cto.com/oss/201711/18/ee3aa13a7b7d7a0b045dfa1962497c01.png "title=" 33333111.png "alt=" Ee3aa13a7b7d7a0b045dfa1962497c01.png "/>

Non-interactive password change


Example 1:

Create 6 user stu01-stu06 in bulk, and set a random 8-bit password that requires no shell looping

Can only be implemented with commands and pipelines

http://oldboy.blog.51cto.com/2561410/1608552

650) this.width=650; "src=" Https://s5.51cto.com/oss/201711/19/433a2881f015b7b0472178f047960c2e.png "style=" width : 730px;height:206px; "title=" 111.png "width=" 730 "height=" 206 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" 433a2881f015b7b0472178f047960c2e.png "/>

650) this.width=650; "src=" Https://s1.51cto.com/oss/201711/19/1ab17cb8dce8636ff045c5674a339f73.png "style=" width : 730px;height:114px; "title=" 222.png "width=" 730 "height=" "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" 1ab17cb8dce8636ff045c5674a339f73.png "/>

650) this.width=650; "src=" Https://s1.51cto.com/oss/201711/19/2aeb6f4fac7215d07f2fd134bd45f8df.png "style=" width : 720px;height:529px; "title=" 333.png "width=" 720 "height=" 529 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" 2aeb6f4fac7215d07f2fd134bd45f8df.png "/>

666

Example 2:

Require curry users can not change the password within 7 days, 60 days after the password must be modified, 10 days before the expiration of the notification curry users,

Users are not allowed to log on for 30 days after expiration.

650) this.width=650; "src=" Https://s5.51cto.com/oss/201711/18/c9e1bf57c04c9f6a6eec65c944368d6b.png "style=" width : 680px;height:157px; "title=" T6.png "width=" 680 "height=" 157 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" C9e1bf57c04c9f6a6eec65c944368d6b.png "/>

This can also be

650) this.width=650; "src=" Https://s5.51cto.com/oss/201711/18/20a8ea70c8b2d379bcbb396ac1c77430.png "title=" t7.png "Width=" 680 "height=" 195 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:680px;height:195px; "alt=" 20a8ea70c8b2d379bcbb396ac1c77430.png "/>

Cat/etc/shadow

650) this.width=650; "src=" Https://s2.51cto.com/oss/201711/18/22e05bb396df98b2591736f5467484db.png "style=" width : 280px;height:27px; "title=" T8.png "width=" 280 "height=" "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" 22e05bb396df98b2591736f5467484db.png "/>


650) this.width=650; "src=" Https://s4.51cto.com/oss/201711/18/d1d98f87dfc2a6188c600675402e3e01.png "title=" t9.png "Width=" "height=" 158 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:600px;height:158px; "alt=" D1d98f87dfc2a6188c600675402e3e01.png "/>

Read the shadow file mainly

650) this.width=650; "src=" Https://s4.51cto.com/oss/201711/18/954cd24e95064d353b0036878ff47811.png "title=" r1.png "Width=" 720 "height=" 356 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:720px;height:356px; "alt=" 954cd24e95064d353b0036878ff47811.png "/>

650) this.width=650; "src=" Https://s3.51cto.com/oss/201711/18/1c7cbad8f6760bacdce9425df2124813.png "style=" width : 680px;height:195px; "title=" R2.png "width=" 680 "height=" 195 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" 1c7cbad8f6760bacdce9425df2124813.png "/>

650) this.width=650; "src=" Https://s3.51cto.com/oss/201711/18/c07db5803f1090931d245fc78e854fcb.png "style=" width : 680px;height:417px; "title=" R3.png "width=" 680 "height=" 417 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" C07db5803f1090931d245fc78e854fcb.png "/>

650) this.width=650; "src=" Https://s1.51cto.com/oss/201711/18/0aab39ebc51030ec94746a4f86e013ac.png "title=" r8.png "Width=" 680 "height=" "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:680px;height:83px; "alt=" 0aab39ebc51030ec94746a4f86e013ac.png "/>

Some view commands

W Show who's logged on and what they aredoing

Who show who's logged on

Last shows the history of user login

/var/log/wtmp

Lastlog Displays the user's most recent logon situation

/var/log/lastlog

Groups see in which group

Id

Users

650) this.width=650; "src=" Https://s2.51cto.com/oss/201711/18/dcd52bd7d99ddc2f6e01bc925c2da6fe.png "style=" width : 680px;height:217px; "title=" 1.png "width=" 680 "height=" 217 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" Dcd52bd7d99ddc2f6e01bc925c2da6fe.png "/>

650) this.width=650; "src=" Https://s1.51cto.com/oss/201711/18/757529c2bafb0e5351ba8cd75bcdd2c8.png "title=" 2.png " Width= "680" height= "315" border= "0" hspace= "0" vspace= "0" style= "width:680px;height:315px;" alt= " 757529c2bafb0e5351ba8cd75bcdd2c8.png "/>

650) this.width=650; "src=" Https://s4.51cto.com/oss/201711/18/c0824dc84f9a85d84944b44d5440caa4.png "style=" width : 680px;height:289px; "title=" 3.png "width=" 680 "height=" 289 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" C0824dc84f9a85d84944b44d5440caa4.png "/>


When the SU command is executed without any parameters, it indicates that you want to switch to the root user, but doing so will encounter some problems, because although

is to switch to the root user, but did not change to the root user login environment, the user default login environment, can be found in the/etc/passwd, including home directory, Shell type, etc., the more standard operation method is Su-root

If you directly su words, though it is Root , but the view information displays the environment variable information or Curry,:


650) this.width=650; "src=" Https://s2.51cto.com/oss/201711/18/a8b5e59ccfbe4c67e17aee45012d8ba6.png "style=" float: none; "title=" R1.png "alt=" A8b5e59ccfbe4c67e17aee45012d8ba6.png "/>

That's OK.

650) this.width=650; "src=" Https://s2.51cto.com/oss/201711/18/fb0fad6f82955c4caaf00a57792b1e3a.png "style=" float: none; "title=" R2.png "alt=" Fb0fad6f82955c4caaf00a57792b1e3a.png "/>

http://oldboy.blog.51cto.com/2561410/1053606/

by su and the Su- on the difference between learning Linux operation and Maintenance methods

650) this.width=650; "src=" Https://s5.51cto.com/oss/201711/18/650193bf50c2ff945e089017111e5312.png "title=" e1.png "Width=" 680 "height=" 287 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" WIDTH:680PX;HEIGHT:287PX; "alt=" 650193bf50c2ff945e089017111e5312.png "/>

650) this.width=650; "src=" Https://s5.51cto.com/oss/201711/18/9a7a374040d6e2f15f650572cf2e6cf8.png "title=" e6.png "alt=" 9a7a374040d6e2f15f650572cf2e6cf8.png "/>


650) this.width=650; "src=" Https://s4.51cto.com/oss/201711/18/17ca9bea518cdaf01321d76cf5ead433.png "style=" width : 680px;height:311px; "title=" E2.png "width=" 680 "height=" 311 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" 17ca9bea518cdaf01321d76cf5ead433.png "/>


650) this.width=650; "src=" Https://s1.51cto.com/oss/201711/18/73305f1ef78b805bd0bac0804302fd3d.png "style=" width : 680px;height:160px; "title=" E4.png "width=" 680 "height=" "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" 73305f1ef78b805bd0bac0804302fd3d.png "/>

650) this.width=650; "src=" Https://s5.51cto.com/oss/201711/18/697a714262b42f0b21102d0325fc1a4c.png "title=" people. png " Width= "height=" 588 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:600px;height:588px; "alt=" 697a714262b42f0b21102d0325fc1a4c.png "/>


#visudo = vim/etc/sudoers equivalent to

But the first one has the grammar check function, generally uses the first one.

650) this.width=650; "src=" Https://s2.51cto.com/oss/201711/18/d25bb9f4ed13045ba8d36303e58191a5.png "style=" float: none; "title=" D1.png "alt=" D25bb9f4ed13045ba8d36303e58191a5.png "/>

To write a command full path

650) this.width=650; "src=" Https://s3.51cto.com/oss/201711/18/293dccebbc043a3ceb64babcf474dcf5.png "style=" width : 680px;height:343px; "title=" D2.png "width=" 680 "height=" 343 "border=" 0 "hspace=" 0 "vspace=" 0 "alt=" 293dccebbc043a3ceb64babcf474dcf5.png "/>

When executing, add sudo to the front



650) this.width=650; "src=" Https://s4.51cto.com/oss/201711/18/1c558caf9c8c44008522d94d755f166c.png "title=" e3.png "Width=" 680 "height=" border= "0" hspace= "0" vspace= "0" style= "width:680px;height:114px;" alt= " 1c558caf9c8c44008522d94d755f166c.png "/>

This article is from the "11745576" blog, please be sure to keep this source http://11755576.blog.51cto.com/11745576/1983280

Linux User Management related

Related Article

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.