使用其他用户登录时启用超级用户

Ion*_*zău 3 users root sudo privileges

假设机器有两个用户:

  • 爱丽丝(管理员)
  • Bob(标准用户)

当 Bob 登录时,Alice 如何修改根文件(即使有 ,Bob 也没有这个权限sudo)?

爱丽丝尝试:

$ sudo vim /etc/hosts
[sudo] password for Bob: 
Bob is not in the sudoers file.  This incident will be reported.
Run Code Online (Sandbox Code Playgroud)

ene*_*dil 13

使用su

su - alice
sudo vim /etc/hosts
Run Code Online (Sandbox Code Playgroud)

来自man su

   The su command is used to become another user during a login session.
   Invoked without a username, su defaults to becoming the superuser. The
   optional argument - may be used to provide an environment similar to
   what the user would expect had the user logged in directly.
Run Code Online (Sandbox Code Playgroud)

有关更多信息,请参阅

man su
Run Code Online (Sandbox Code Playgroud)

维基百科

  • 见`man su`。`su` 允许用户登录其他人的帐户。http://en.wikipedia.org/wiki/Su_%28Unix%29 (2认同)