Skip to content

Instantly share code, notes, and snippets.

@ks4na
Last active January 14, 2022 08:17
Show Gist options
  • Save ks4na/070c50d43b9c5b4e4fcf5c2f7c79b39e to your computer and use it in GitHub Desktop.
Save ks4na/070c50d43b9c5b4e4fcf5c2f7c79b39e to your computer and use it in GitHub Desktop.
centos 7 创建常用非root用户
# 创建用户
adduser yuusha

# 设置密码
passwd yuusha

# 添加 sudo 权限
# 查看 sudoers 文件存放位置
whereis sudoers 
# 在 /etc/sudoers.d 目录下创建 user-yuusha 文件保存 yuusha 的 sudo 权限信息
cd /etc/sudoers.d && vi user-yuusha

# 添加如下内容
yuusha ALL=(ALL) ALL
# 保存并退出即可
# 如果不想在使用 sudo 命令时需要输入密码,可以使用如下配置
# yuusha ALL=(ALL) NOPASSWD:ALL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment