【发布时间】:2017-03-23 13:22:03
【问题描述】:
运行 sudo -i 我最终在我的 Linux 机器上获得了一个 root shell。
但阅读-i 选项时说:
-i, --login
Run the shell specified by the target user's password database entry as a login shell. This means that
login-specific resource files such as .profile or .login will be read by the shell. If a command is
specified, it is passed to the shell for execution via the shell's -c option. If no command is speci‐
fied, an interactive shell is executed. sudo attempts to change to that user's home directory before
running the shell. The command is run with an environment similar to the one a user would receive at
log in. The Command Environment section in the sudoers(5) manual documents how the -i option affects
the environment in which a command is run when the sudoers policy is in use.
我不清楚。
为什么target user 是根?
这与sudo su 有何不同?
【问题讨论】:
-
sudo的目标是始终根除非指定。