linux 服务器添加个人账户

1.添加个人账户

  • cd path
  • adduser ozh
    设置密码,其它选项按默认即可,账户即添加成功
  • su ozh
    输入密码后即可切换到新创建的账户

2.给用户添加sudo权限

  • linux下直接运行sudo命令,会提示类似:
    xxxis not in the sudoers file. This incident will be reported.
  • 切换到超级用户模式
    如 su zerotech
  • 编辑 /etc/sudoers
    sudo visudo,进入编辑模式,找到这一 行:”root ALL=(ALL) ALL”在起下面添加”xxx ALL=(ALL) ALL”(这里的xxx是你的用户名),然后保存退出。
    sudo vim /etc/sudoers 即可看到成功添加 ozh ALL=(ALL) ALL

3.修改密码

在超级用户权限下,输入sudo passwd ozh,然后两次输入密码,即可修改密码。

猜你喜欢

转载自blog.csdn.net/u013187057/article/details/80533249