Linux Redhat Basic Operations 3

Source: Internet
Author: User
Tags chmod save file

ID # # #查看用户信息

Id-u # # #查看用户uid

-G # # #查看用户所在组id

-A # # View all user information

-G # # #查看用户所在所有组id (including all history groups)

-un # # #查看用户名字

-GN # # #查看用户初始组名称

-GN # # #查看用户所有组名称


su-username## #加杠会改变用户的环境, not only changed the user name, but also changed the user bash environment

Echo $PATH # #查看当前用户的用户环境

Echo $USER # #查看当前用户信息

Cat/etc/group # #查看组信息

/etc/passwd# #查看用户所有信息, including home directory information

/etc/shadow# #查看用户家目录名称

/etc/shalls # #查看系统的所有shell, plus s

/sbin/nologin# #表示此用户的shell是非交互

/bin/bash # #表示此用户的shell是交互的


Useradd-u uid-g GID Username # #新增用户, to specify the UID of the user, specify the user initial group ID

-d/mnt/test test# #改变用户家目录信息

# #新建用户uid默认是从1001开始, according to the file/etc/login.defs.

Userdel-r username# #删除用户



Usermod-u # #改变用户uid

The name changed after the name of-L was renamed # #改变用户名字

-G uid username# #改变用户初始组

-G GID username# #改变用户附加组

-ag GID username# #增加用户附加组

-D # #改变用户家目录信息

-MD # #改变用户家目录信息和家目录名称

-S # #改变用户的shell

-C # #改变用户的说明

-L # #冻结 (locked) user, this user cannot log on, but the root user can manage this user

-U # #解锁用户


Groupadd-g GID groupname# #增加组信息

Groupdel GroupName # #删除组


Visudo # #查看和编辑权限信息, Root gives permissions to ordinary users

The edited content is the/etc/sudoers file

User name + hostname + "" (root) + NOPASSWD permissions

Test desktop0.example.com = (root) nopasswd:/usr/sbin/useradd,/usr/sbin/userdel

Normal User Run

sudo useradd test2

sudo userdel test2

Add sudo to the front to indicate the use rights

Watch-n 3 ' tail-3/etc/shadow '

/etc/shadow # # #查看用户密码信息

CHAGE-M Username # #改变密码最短有效期

-M username # #改变密码最长有效期

-W 7 username # #改变密码警告期

-I 3 username # #改变密码非活跃期

-e 2016-10-27 Username # #改变密码还有多长时间到期

Modifky MoD



PTS Output Save File

L Link

Ls-l Viewing file properties

1. The number of times the file contents are recorded by the system

-Documents

Catalog D


r# #对于目录是可以可见, for file is can see

w# #对于目录是删除, can be written and modified for files

x# #对于目录是可以 for files that can be executed


6 file property size, the larger the file the larger the property


chown username FileName # #改变文件属性权限为username

Chown Username.groupname Path-R # #第归改变此目录下所有文件权限为所有者为username组名为root

CHGRP groupname filename Change file attribute group to GroupName


chmod O+wx/mnt/test1 # #改变test1文件其他用户权限为可写可执行

chmod U+rwx/mnt/test1 # #改变test1文件所有者权限为


"Id-gn" = "Id-un" # #用户初始组id和用户id相同的情况


Cat/etc/group # #查看组信息



This article is from the "12086672" blog, please be sure to keep this source http://12096672.blog.51cto.com/12086672/1857529

Linux Redhat Basic Operations 3

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.