centos用户管理-建用户练习

  • 建用户db01

    [root@centos1 ~]# useradd db01
    [root@centos1 ~]# passwd db01
    更改用户 db01 的密码 。
    新的 密码:123456
    无效的密码: 密码少于 8 个字符
    重新输入新的 密码:
    passwd:所有的身份验证令牌已经成功更新。
    [root@centos1 ~]# 
  • 用户db01-加上sudo权限

    [root@centos1 jdk]# cat /etc/sudoers|grep wheel #查看允许sudo权限的组
    ## Allows people in group wheel to run all commands
    %wheel  ALL=(ALL)       ALL
    # %wheel        ALL=(ALL)       NOPASSWD: ALL
    [root@centos1 jdk]# groups db01 #查看用户组
    db01 : db01
    [root@centos1 ~]# usermod -a -G wheel db01 #将用户db01加入wheel组,即可拥有sudo权限
    [root@centos1 ~]# groups db01
    db01 : db01 wheel
    [root@centos1 ~]#
    #用户需要退出重新登录才能生效

猜你喜欢

转载自blog.csdn.net/mnbwz/article/details/113815630