当我以 登录时username,为什么
sudo ls ~
Run Code Online (Sandbox Code Playgroud)
向我展示而不是的内容?我认为以 root 身份执行命令,在这种情况下将代表./home/username/rootsudo~/root
更多解释:
此外,如果我运行su命令,然后运行ls ~,我会看到/root. 所以我认为这样做相当于sudo ls ~.
再举一个例子,一些带有--user标志的命令在以sudo. 例如,将安装到 内的目录 ,而 将安装到. 请注意,不建议运行最后一个命令,我只是使用它来显示我所描述的功能。pip install --user packagename/home/usernamesudo pip install --user packagename/root
我创建了一个 user1 并尝试使用将用户切换到 user2 帐户sudo -i user2。但是我收到此错误:
Sorry, user user1 is not allowed to execute '/bin/bash -c user2' as root on hostname.
Run Code Online (Sandbox Code Playgroud)
请在这方面协助我。
假设我想教某人命令行,但一开始,我只想教他们sudo命令。这意味着所有基本和有用的命令行,但使用sudo.
这需要使用基于 Debian 的操作系统,对吗?例如,像 Ubuntu。还是我误解了某些事实?
我想在Debian上安装mysql,但出现错误
admin@localhost:~$ sudo apt-get install mysql-server
[sudo] password for admin:
admin is not in the sudoers file. This incident will be reported.
Run Code Online (Sandbox Code Playgroud) 我通过 SSH 连接到我的新 Linux 机器(没有物理访问权限)并且我有 root 凭据。但是,我无法运行 sudo 命令,因为之前以 root 身份登录的其他人在 sudoers 文件中出现了一些错误。
我曾经visudo将我的用户名添加到列表中,当前文件权限为:
-r--r----- 1 root root 3419 May 29 11:57 /etc/sudoers
Run Code Online (Sandbox Code Playgroud)
我收到以下错误消息:
>>> /etc/sudoers: syntax error near line 82 <<<
sudo: parse error in /etc/sudoers near line 82
sudo: no valid sudoers sources found, quitting
Run Code Online (Sandbox Code Playgroud)
请看一看,让我知道你们认为是什么问题。
我的 sudoers 文件的内容是:
## Sudoers allows particular users to run various commands as
## the root user, without needing the root password.
##
## Examples are provided at the bottom …Run Code Online (Sandbox Code Playgroud) 有最新安装的 ubuntu 17.04,我无法运行命令 sudo nautilus 它给出了错误。然后我在谷歌上搜索并尝试了 sudo -E nautilus 并且它起作用了。两者有什么区别。