JAVA_HOME not found as Sudo

前端 未结 3 749
傲寒
傲寒 2021-01-01 21:22

I have a bash script on a Linux box that runs a Jar file. When logged in as a regular user I don\'t have permission to run the script, but it prints the following log:

3条回答
  •  清歌不尽
    2021-01-01 21:55

    By default, sudo will cleanup the environment of the spawned commands. Pass -E to keep it:

    sudo -E env
    

    Compare to:

    sudo env
    

提交回复
热议问题