[英]“sudo command” doesn't work, but “command” as root works
I'm trying to install Phusion Passenger on Ubuntu 12.04. 我正在尝试在Ubuntu 12.04上安装Phusion Passenger。
When I try: 当我尝试:
sudo passenger-install-apache2-module
...I get: ......我明白了:
sudo: passenger-install-apache2-module: command not found
However, when I omit the sudo, it works fine. 但是,当我省略sudo时,它运行正常。 Also, when I log in as root and run
passenger-install-apache2-module
, it works fine as well. 此外,当我以root身份登录并运行
passenger-install-apache2-module
,它也能正常工作。 Why would sudo passenger-install-apache2-module
not work when logged in as my non-root user, yet work fine when logged in as root? 为什么
sudo passenger-install-apache2-module
在以非root用户身份登录时无效,但以root身份登录时工作正常?
This is because passenger-install-apache2-module
is not on your path as a normal user, but it is as root. 这是因为
passenger-install-apache2-module
不是普通用户的路径,而是root用户。 (it's probably in /usr/sbin
- see below) (它可能在
/usr/sbin
- 见下文)
run which passenger-install-apache2-module
as root and it will tell you where it is (which you can then run using sudo /full/path/to/passenger-install-apache2-module
以root身份运行
which passenger-install-apache2-module
,它会告诉你它在哪里(然后你可以使用sudo /full/path/to/passenger-install-apache2-module
sbin
directories ( /sbin
and /usr/sbin
normally) contain the commands that are used for system administration. sbin
目录( /sbin
和/usr/sbin
通常)包含用于系统管理的命令。 Typically these require elevated privileges or just don't make sense for ordinary users to be running them. 通常,这些都需要提升权限,或者只是普通用户无法运行它们。 This is why by default these directories are not on ordinary user's paths - it would just clutter things up.
这就是为什么默认情况下这些目录不在普通用户的路径上 - 它只会使事情变得混乱。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.