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

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

假设机器有两个用户:

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

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

爱丽丝尝试过:

$ sudo vim /etc/hosts
[sudo] password for Bob: 
Bob is not in the sudoers file.  This incident will be reported.

答案1

使用su

su - alice
sudo vim /etc/hosts

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.

有关更多信息,请参阅

man su

维基百科

相关内容