开发者

change user in sudo bash script

In a bash script that is called with sudo i am calling:

/usr/bin/firef开发者_StackOverflowox -new-tab http://stackoverflow.com

but then i get the message:

Firefox is already running, but is not responding. To open a new window, you must first close the existing Firefox process, or restart your system

this is, i guess, because the script is called by sudo and firefox by the normal user. if i would call the command without sudo it works.

so how can i switch back to the normal user in a sudo called script?


using sudo again inside your script.

sudo -u user -H /usr/bin/firefox -new-tab http://stackoverflow.com


This post might answer your question

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜