Give me a home for a first-knowledge of Linux

Source: Internet
Author: User

User Management
1. User/Group Basic concept
View current logged-on user information: ID
View the file's owner:ll to see who owns the file
View running process: PS aux | Less, split-screen displays the current process
Storage files for users and groups/etc/passwd
Gdm:x:42:42::/var/lib/gdm:/sbin/nologin
Username: x is a password placeholder: The first 42 User id: The second 42 is the group ID: Descriptor: Home directory: Shell
/etc/shadow
xirui:$6$tpjodu.qcr3mlkv6$hevvjky/ Kubgqjd.0kfueft6yusd6mjevz9mzckxxwrr64fccxg4hexrhissi88vw405f8khpo7xwjmzgb6nf.:17547:0:99999:7:::
Login: Encrypted password: The last modified time: The minimum time interval (after how many days after the password can be changed): The maximum time interval (after which the password must be changed): Warning Time: Inactivity time (is the time period after arrival warning time, will force the change password [elastic] can be infinitely repeated): Expiration Time (is a point, after reaching this time, the permission is retracted [hard retract]): Flag
/etc/group Group
Group name: Password placeholder, GID, team member
2. User/Group Management
Create user, no option specified
useradd+ User name: Primary group, additional group, HOME,SHELL,UID not specified user
Create user, execute options
-u specifies UID useradd-u 1001 User01
-D Specify user home directory Useradd user02-d/aaa
-S Set User login shell Useradd user05-s/sbin/nologin//create user and specify Shell
-G Specify additional groups
-M do not specify home directory
USERMOD-G 1001 user03//Add USER03 to 1001 groups, overwrite if previous additional group, can be appended by command Usermod-ag 1003 User03 via-A
Delete User
Userdel-r User02 completely delete the user's mailbox and home directory, etc.
User password
Change password by passwd, normal users can only change their own password
echo 123456 |passwd--stdin maomao100//stdin is a standard input, given passwd by standard input piping, and standard input to maomao100 this option
Group member Management
User components are basic groups and additional groups
Creating a user By default generates a group that is the same as the user
Usermod-g (Basic Group)-G (additional group) 1001 User01
Other options Management
3. Right of withdrawal
Permanent right, use su, switch directly to Su-root
Temporary power, with sudo, as root to authorize ordinary users, configuration files in Vim/etc/sudoers
%wheel all = (All) nopasswd:all
Wheel is a special group in which users in this group can execute sudo and need to add a user to an additional group wheel.

4. Expand your knowledge

Symmetric asymmetric hashing algorithm encryption
The original content, combined with the key, generates ciphertext
Difforkharman algorithm
Shadow encrypted password inside will have $$, two of the number meaning between $. Separate encryption algorithms and results.
Linux: January 1, 1970
See Shadow the time of the string
Man manual man 5 passwd Shadow Group Man 3 crypt

Useradd maomao100
echo 123456 |passwd--stdin maomao100//output directed to maomao100 password
chage-d 0 maomao100//Change Password Policy

Useradd Some parameters
-B,--base-dir base_dir The base directory of the new account's home directory
-C,--comment comment The new Account GECOS field
-D,--home-dir Home_dir The new account's home directory
-D,--defaults displays or changes the default Useradd configuration
-E,--expiredate expire_date the expiration date of the new account
-F,--inactive inactive Password inactivity period for new account
-G, name or ID of the--gid group new Account-G,--groups groups additional group list for new accounts
-H,--help displays this help information and launches
-K,--skel skel_d IR uses this directory as the skeleton directory
-K,--key Key=value does not use the default value in/etc/login.defs
-L,--no-log-init do not add this user to the most recent logon and logon failure database
-M,-- Create-home creating a user's home directory
-M,--no-create-home does not create a user's home directory
-N,--no-user-group does not create a group with the same name
-O,--non-unique allows duplicate UID Create user
-P,--password password new account password after encryption
-R,--system create a System account
-R,--root Chroot_dir CHROOT to the directory
-S,--shell SH ELL New Account Login Shell
-u,--uid uid new account user ID
-u,--user-group create a group with the same name as the user
-Z,--selinux-user seuser for SELinux user mapping using the specified Seuser

Here is a small loop
18 People, 1800 servers
#! /bin/bash
passwd=linux1801
For i in {1..100}
Do
Useradd user$i
echo "$PASSWD" |passwd--stdin user$i
Done

Give me a home for a first-knowledge of Linux

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.