linux 命令组,Linux 的用户和组命令

Linux 的用户和组命令

[日期:2013-05-07]

来源:Linux社区

作者:vfast_zyfeifie

[字体:大 中 小]

本文仅为个人学习笔记总结及一些中英文互译,仅作学习参考之用,希望能给初入门者以帮助。

useradd 命令

useradd - create a new user or update default new user information 创建一个新账户或者更新默认新账户的信息

-c,  --comment  添加账户时对该账户的描述

-d,  --home 指定账户的HOME_DIR  家目录

-e, --expiredate 设置账户的EXPIRE_DATE 过期时间

-f, --inactive INACTIVE 创建该账户时,是否启用过期机制

-g, --gid GROUP  指定组ID号

-G, --groups GROUP1[,GROUP2,...[,GROUPN]]]  建立账户的附加组

-m, --create-home  建立账户时,建立家目录

-M  Do not create the user′s home directory, even if the system wide setting from /etc/login.defs (CREATE_HOME) is set to yes. 建立用户账户时,不建立家目录

-N, --no-user-group 不指定用户同名组

-r, --system    指定该帐号是系统帐号

-s, --shell SHELL  指定登录shell

-u, --uid UID  指定用户ID号

-U, --user-group 指定用户创建用户同名组

-o 创建用户是可以uid重复

example

zhang:x:1234:1234:TEST USER:/home/zhang:/bin/bash  使用一段时间后希望修改为

zhang:x:2345:2345:haha:/tmp/zhang:/bin/csh

usermod 命令

usermod - modify a user account 修改用户账户的配置

-a, --append  追加。。。把用户追加到指定组

-L, --lock    锁定账户

U, --unlock  解锁账户

-m, --move-home with -d

删除用户账户命令

userdel - delete a user account and related files

-f, --force

-r, --remove

chage 命令

-d, --lastday LAST_DAY        set date of last password change to LAST_DAY

-E, --expiredate EXPIRE_DATE  set account expiration date to EXPIRE_DATE

-h, --help                    display this help message and exit

-I, --inactive INACTIVE      set password inactive after expiration to INACTIVE

-l, --list                    show account aging information

-m, --mindays MIN_DAYS        set minimum number of days before password change to MIN_DAYS

-M, --maxdays MAX_DAYS        set maximim number of days before password

change to MAX_DAYS

-W, --warndays WARN_DAYS      set expiration warning days to WARN_DAYS

group manager 组的管理

groupadd  添加一个新组

groupadd - create a new group

-g, --gid GID

-r, --system

groupmod 修改组的配置信息

groupmod - modify a group definition on the system

-g, --gid GID

-n, --new-name NEW_GROUP

删除组

groupdel

groupdel - delete a group

passwd  命令

-l lock 锁定一个账户

-u unlock 解锁一个账户

-d delete a passwd  for an account 删除某个账户的密码,允许其空密码登录

-S  This will output a short information about  the  status  of  the password for a given account.输出某个既有账户的密码状态的简单信息(或者叫概述)

--stdin

echo linux |passwd --stdin vfast    1 > 0

gpasswd      newgrp(临时加入到组)

gpasswd - administer /etc/group and /etc/gshadow

-a, --add USER                add USER to GROUP

-d, --delete USER            remove USER from GROUP

-r, --remove-password        remove the GROUP's password

-R, --restrict                restrict access to GROUP to its members

-M, --members USER,...        set the list of members of GROUP

-A, --administrators ADMIN,...set the list of administrators for GROUP

/etc/passwd  User account information,文件中存储了用户账户信息,其文件格式为:

[用户名]:[密码]:[UID]:[GID]:[身份描述]:[主目录]:[登录shell]

/etc/shadow Secure user account information.该文件中存放的是安全账户信息

用户名:这是用户登录系统时使用的用户名,它在系统中是惟一的

口令:此字段存放加密的口令

最后一次修改的时间:标识从某一时刻起到用户最后一次修改口令的天数

最小时间间隔:两次修改口令之间的最小天数

最大时间间隔:口令保持有效的最多天数,即多少天后必须修改口令

警告时间:从系统开始警告到口令正式失效的天数

不活动时间:口令过期多少天后,该账号被禁用

失效时间:指示口令失效的绝对天数(从1970年1月1日开始计算)

标志:未使用

/etc/group  Group account information. 组账户信息

文件格式为:

[组名]:[密码域]:[GID]:[组员列表]

/etc/gshadow  Secure group account information.  组安全帐号信息

/etc/default/useradd  Default values for account creation. 创建账户的默认值

/etc/skel/  Directory containing default files. 新建用户默认模版文件夹

 /etc/login.defs  Shadow password suite configuration. 新建用户默认值设置文件   0b1331709591d260c1c78e86d0c51c18.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值