Linux sudo xxxx:command not found问题

在/usr/local/目录下安装了nginx,并将nginx/sbin加入PATH,却提示:command not found。

# 切换到root用户
$ vim /etc/profile  
export PATH=$PATH:/usr/local/nginx/sbin  
$ source /etc/profile  
$ which nginx
/usr/local/nginx/sbin/nginx
$ nginx -t #到这里是OK的

#切换到普通用户,比如test用户
$ nginx -t
nginx: [warn] the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /usr/local/nginx/conf/nginx.conf:2
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: [emerg] open() "/vdb/logs/nginx/nginx.pid" failed (13: Permission denied)
nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed
#从输出来看,这是权限不够原因。

$ sudo nginx -t
sudo nginx:commmand not found
#加上sudo又提示找不到此命令
#明明把nginx加入了PATH环境变量,为啥使用sudo,还找不到nginx这个命令了呢?

#经过一番苦苦思考与百度,发现只有在“/etc/sudoers”里面的secure_path指定目录下的命令才可以使用sudo。
$ cat /etc/sudoers
......
Defaults    secure_path = /sbin
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值