笔记:

  使用源码部署nginx的时候,使用sudo nginx提示command not found,但是直接使用nginx会导致权限问题:

  使用sudo执行命令提示command not found

  这种情况应该是环境变量导致的,使用 env |grep PATH 和 sudo env |grep PATH 发现两者变量值不一样

  使用sudo执行命令提示command not found

  解决办法:

  使用 sudo vim /etc/sudoers 打开文件修改env_reset参数,然后 :wq! 退出

  使用sudo执行命令提示command not found

  接着修改.bashrc文件,使用vim ~/.bashrc打开,加上 alias sudo='sudo env PATH=$PATH' ,然后 :wq 退出,使用 source ~/.bashrc 重新加载

  使用sudo执行命令提示command not found

  

相关文章:

  • 2021-06-05
  • 2022-12-23
  • 2022-02-15
  • 2021-12-05
  • 2022-12-23
猜你喜欢
  • 2021-07-07
  • 2022-12-23
  • 2021-11-08
  • 2022-12-23
  • 2021-09-01
  • 2021-08-08
  • 2021-12-22
相关资源
相似解决方案