linux 用户管理常用部分

  1. 添加用户

添加用户、密码并指定用户组

adduser user1 -p 123456 -g 501

2.添加组
添加指定组ID的用户组

groupadd -g 502 frant

3.chage
显示root用户的策略信息

 chage -l root 

修改密码过期时间为一个月 数字改为0即刻提示修改

 chage -M 30 root 

设置密码失效时间

 chage -I  5 root 

4.普通用户暂时提权
编辑模式下在添加:

 vi  /etc/sudoers 
  name   ALL=(ALL)     NOPASSWD:  ALL

5.文件权限管理

  • chown 改文件所有者

    chown root:root hello.c

  • chgrp 改组 递归将testfiles下的文件所属组改为frant

    chgrp -R frant /home/testuser/testfiles

  • chmod

chmod g+rw testfiles
同组用户都具有对testfiles拥有读写权限

u,g,o 表示User、Group、及Other的权限

猜你喜欢

转载自blog.csdn.net/qq_42898087/article/details/81543136