Skip to content

Instantly share code, notes, and snippets.

@ibreathebsb
Last active September 12, 2018 01:06
Show Gist options
  • Save ibreathebsb/4a6d1e6f7a3f368793739f5a65d4d8e4 to your computer and use it in GitHub Desktop.
Save ibreathebsb/4a6d1e6f7a3f368793739f5a65d4d8e4 to your computer and use it in GitHub Desktop.
  1. su - user 只能切换到能够登录的用户,并且需要输入user的密码
  2. su 直接使用su,切换到root但是$PATH等环境变量不会改变,因此不推荐此方式
  3. sudo -u user command 输入当前用户自己的密码,并以user的身份执行命令

sudo

  1. 配置文件 /etc/sudoers,文件格式:用户 登录主机(可切换的用户) 可使用的绝对路径命令

  2. 编辑命令visudo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment