User management of Linux learning

Source: Internet
Author: User

User management is done under the root user 1, the configuration file path: Save user information files:/etc/passwd Save password file:/etc/shadow Save user Group files:/etc/group Save User group password file:/etc/gshadow user profile:/ETC/DEFAULT/USERADD2, viewing user information: cat/etc/passwd[[email protected] hjp]# cat /etc/passwdroot:x:0:0:root:/root:/bin/bashbin:x:1:1:bin:/bin:/sbin/nologindaemon:x : 2:2:daemon:/sbin:/sbin/nologinadm:x:3:4:adm:/var/adm:/sbin/nologinlp:x:4:7:lp:/var/spool/lpd:/sbin/ nologinsync:x:5:0:sync:/sbin:/bin/syncshutdown:x:6:0:shutdown:/sbin:/sbin/shutdownhalt:x:7:0:halt:/sbin:/sbin/ HALTMAIL:X:8:12:MAIL:/VAR/SPOOL/MAIL:/SBIN/NOLOGINOPERATOR:X:11:0:OPERATOR:/ROOT:/SBIN/NOLOGINGAMES:X:12:100: games:/usr/games:/sbin/nologinftp:x:14:50:ftp user:/var/ftp:/sbin/nologinnobody:x:99:99:nobody:/:/sbin/ NOLOGINAVAHI-AUTOIPD:X:170:170:AVAHI IPV4LL STACK:/VAR/LIB/AVAHI-AUTOIPD:/SBIN/NOLOGINDBUS:X:81:81: System message bus:/:/sbin/nologinpolkitd:x:999:998:user for polkitd:/:/sbin/nologintss:x : 59:59:ACCOUNT USED BY THE TROUSERS PACKAGE TO SANDBOX THE TCSD  daemon:/dev/null:/sbin/nologinavahi:x:70:70:avahi mdns/dns-sd stack:/var/run/avahi-daemon:/ Sbin/nologinpostfix:x:89:89::/var/spool/postfix:/sbin/nologinchrony:x:998:997::/var/lib/chrony:/sbin/nologinsshd:x:74:74:privilege-separated  ssh:/var/empty/sshd:/sbin/nologinhjp:x:1000:1000:hjp:/home/hjp:/bin/bash last user Hjp,id starting from 1000, analyzing hjp:x : 1000:1000:hjp:/home/hjp:/bin/bash separated by colon, Hjp: username                     x: Password placeholder                     1000: User id          &NB Sp         1000: User group id                    HJP: Description information for users &N Bsp                  /HOME/HJP: Home directory             &N Bsp      /bin/bash:shell, which exists for the purpose of protecting the operating system, exists on the kernel, provides an instruction interface for users to interact with the system, and bash can be compatible with Linux and Unix3, Useradd TestUser     Add user testuser, use cat/etc/passwd to view one more user testuser        TESTUSER:X:1001:1001: :/home/testuser:/bin/bash4, passwd testuser     Add/Modify TESTuser Password 5, userdel testuser     Delete user testuser (and do not delete the user home directory, switch to the home folder, ll command can view) 6, Userdel-r testuser     Delete User testuser and its home directory 7, usermod-l testuser1 testuser     Modify testuser user's login name is TESTUSER1,CAT/ETC/PASSWD View user information for         testuser1:x:1001:1001::/home/testuser:/bin/bash (just change the user name)         changed the username and changed the password by passwd TestUser1 8, modify the new user TestUser1 home directory         (1), Root user Create folder under Home directory TestUser1    mkdir testuser1        (2), change TestUser1 folder belongs to user and user group    chown Testuser1:testuser TestUser1 (there are no newly created user groups, so the previous user groups are used)         (3), Edit Modify user Information TestUser1 the user points to the home directory    VI/ETC/PASSWD Enter     Modify the user to point to the home directory as TestUser1 (in general mode, I means inserting after the cursor, shift+ ZZ Save and exit shortcut keys)         (4), copy testuser folder under Config file (hidden file) to TestUser1    CD testuser Enter, ll-a enter, CP. Bash_profile. BASHRC. /testuser1 Enter (copy only these two profiles), switch to TestUser1 folder view         (5), modify the TestUser1 folder under the configuration fileUsers and user groups    LL-A view configuration files, Chown testuser1:testuser. bash* Enter, ll-a view file information changed (TestUser folder and its sub-files can be deleted)         (6), exit the current user, test login can 9, usermod-g Testuserg testuser     Modify testuser users belong to the user group TESTUSERG10, usermod-g Testuserg,root testuser     Modify testuser user belongs to Testuserg and root two user groups    groups Directive View Group 11, usermod-d/home/ TestUser1 testuser     Modify testuser User home directory is under the Home Folder TestUser1 folder (this folder should have a configuration file, log on to normal) (through 8 and 9 see some changes can be modified by the command) 12 , Groupadd TESTG     Add user group TESTG13, Groupdel testg     Delete user group TESTG14, groupmod     directives for modifying user groups

User management of Linux learning

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.