[sudo-users] ssh + Nohup + sudo

Todd C. Miller Todd.Miller at courtesan.com
Wed May 9 19:40:15 EDT 2012


On Wed, 09 May 2012 21:04:18 -0000, JR Aquino wrote:

> Was there a change in sudo 1.7.2... That would have effected commands started
>  over ssh via sudo?
> 
> What I am trying is: ssh -t -t user at host "nohup sudo /etc/init.d/somescript.s
> h"  <- This used to work (I.e. the daemon launched via this would continue ru
> nning thanks to the 'nohup')
> 
> What I am seeing now is the commands all execute, but as soon as ssh ends the
>  session and the tty is freed, the daemon dies along with it.

If you are using I/O logging sudo will allocate its own pty which
the command will run in.  When sudo finishes, the command would
receive SIGHUP since the command itself is not being run under
nohup.

I would expect this to work OK if you did:

ssh -t -t user at host "sudo nohup /etc/init.d/somescript.sh" 

 - todd



More information about the sudo-users mailing list