
我以 root 使用者身分執行 crontab:
screen -S konsola -X stuff 'say hello'`echo -ne '\015'`
如何以“nobody”用戶身份運行它?只有這個用戶擁有給定 pid 的螢幕,這就是我需要它的原因。
答案1
難道你不能只是用來crontab -u nobody -e
將你的指令加入沒有人的 crontab 中嗎?
否則我會把它放在 root crontab 中:
su nobody -c "screen -S konsola -X stuff 'say hello'`echo -ne '\015'`"
從手冊頁:
The su command is used to become another user during a login session.
[...]
-c, --command COMMAND
Specify a command that will be invoked by the shell using its -c.