linux-Basics-Day 7th

Source: Internet
Author: User

One, Linux and Windows inter-pass files

Method One: How to use SFTP

Install to log in directly to Linux, if you export files from Linux you need to do so

The way of sftp upload, very simple, direct mouse drag, you can

Method Two: Using Software Lrzsz

Yum Install-y Lrzsz

Rz-y Upload

SZ File download

Ii. User and Group management

User and Group Management

Resource allocation:

Authentication: Certification

Authorization: Authorization

Accouting: Audit


Linux Users: Username/uid

admin: Root, 0

Normal Users: 1-65535

System users: 1-499, 1-999

Access to resources for the daemon to assign permissions;

Login User: 1000+,

Interactive login;


Linux Group: Groupname/gid

Administrators group: root, 0

Normal Group:

System groups: 1-499, 1-999

General Group: 1000+,


Linux Security Context:

Running programs: Processes (process)

Run as the process initiator:

Root:cat

Tom:cat

The permissions of all resources that the process can access depend on the identity of the initiator of the process;


Categories of Linux groups:

Basic Group of users (primary group):

The group name is the same as the user name and contains only one user: private group

Additional Groups for users (additional groups):


Linux User and group related configuration files:

/ETC/PASSWD: User and its attribute information (name, UID, base group ID, etc.);

/etc/group: Group and its attribute information;

/etc/shadow: User password and its related attributes;

/etc/gshadow: group password and its related attributes;

/ETC/PASSWD:

Name:password:UID:GID:GECOS:directory:shell

User name: Password: UID:GID:GECOS: Home directory: Default Shell

/etc/group:

Group_name:password:GID:user_list

Group name: Group Password: GID: List of users with the current group as additional groups (comma delimiter)

/etc/shadow

Username: encrypted Password: the date of the most recent password change: Minimum password Age: Maximum password Age: password warning Period: Password Disable period: Account expiration Date: Reserved field

Encryption mechanism:

Encryption: Clear-and redaction

Decryption: ciphertext-to-plaintext

One-way encryption: extracting data fingerprints

Md5:message Digest, 128bits

Sha1:secure hash Algorithm, 160bits

Sha224:224bits

Sha256:256bits

Sha384:384bits

Sha512:512bits

Avalanche effect: A small change in initial conditions will result in a huge change in results;

Fixed-Length output:

Complexity Policy for passwords:

1, the use of numbers, uppercase letters, small letters and special characters in at least 3;

2, long enough;

3, the use of random password;

4, regular replacement; Do not use passwords that have been used recently;


User and group-related administrative commands:

User created: Useradd

useradd [Options] LOGIN

-U UID: [Uid_min, Uid_max], defined in/etc/login.defs

-G GID: Indicates that the user belongs to the basic group, can be a group name, can also GID;

-C "COMMENT": User's comment information;

-d/path/to/home_dir: The home directory with the specified path;

-S Shell: Indicates the user's default shell program, the available list is in the/etc/shells file;

-G group1[,group2,... [, GROUPN]] : Specifies additional groups for the user, and the group must exist beforehand;

-r: Create a System user

CentOS 6:id<500

CentOS 7:id<1000

Default setting: In the/etc/default/useradd file

Useradd-d

-S SHELL


Group creation: Groupadd

Groupadd [OPTION] ... group_name

-G GID: Specifies the GID number; [Gid_min, Gid_max]

-r: Create a system group;

CentOS 6:id<500

CentOS 7:id<1000


View user-related ID information: ID

ID [OPTION] ... [USER]

-u:uid

-g:gid

-g:groups

-n:name


To switch users or execute commands as other users: Su

Su [Options ...] [-] [user [args ...]]

How to switch users:

Su UserName: Non-login switch, that is, the target user's configuration file will not be read;

Su-username: Login switch, will read the target user's configuration file; switch completely;

Note:root Su to other users do not need a password, non-root user needs a password when switching;

To change the identity of the execution command:

Su [-] username-c ' COMMAND '

Options:

-L: "Su-l UserName" equals "Su-username"


User Property Modification: Usermod

usermod [OPTION] Login

-U uid: New UID

-G GID: New Basic Group

-G group1[,group2,... [, GROUPN]] : The new add-on group, the original additional group will be overwritten, if the original, you want to use the-a option at the same time, indicating append;

-S shell: new default shell;

-C ' COMMENT ': new annotation information;

-D Home: New home directory, files in the original home directory will not be moved to the new home directory at the same time, to move, then use the-M option;

-L login_name: new name;

-l:lock the specified user

-u:unlock the specified user

-E YYYY-MM-DD: Indicates the user account expiration date;

-F INACTIVE: set inactivity period;


Add password to User: passwd

passwd [OPTIONS] UserName: Modify the password of the specified user, only the root user rights

passwd: Modify your password;

Common options:

-L: Lock the specified user

-U: Unlock the specified user

-N mindays: Specifying the shortest period of use

-X maxdays: Maximum lifespan

-W Warndays: How many days in advance to start warning

-I inactivedays: inactivity period;

--stdin: Receive user password from standard input;

echo "PASSWORD" | passwd--stdin USERNAME

Note:/dev/null, bit buckets

/dev/zero,


Delete User: Userdel

Userdel [OPTION] ... login

-r: Delete user home directory;


Group Property Modification: Groupmod

Groupmod [OPTION] ... group

-N group_name: New name

-G GID: New Gid;


Group deletion: Groupdel

Groupdel GROUP


Group Password: gpasswd

GPASSWD [OPTION] GROUP

-A User: Adds the user to the specified group;

-D User: Removes additional groups of users with the current group as the group name

-A user1,user2,...: Set up a list of users with administrative rights


NEWGRP command: temporarily switch base Group;

If the user does not belong to this group, then the group password is required;




linux-Basics-Day 7th

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.