bugzilla-daemon at bugzilla.mindrot.org
2008-May-28 14:58 UTC
[Bug 1473] New: Add option to save PID of a backgrounded ssh process
https://bugzilla.mindrot.org/show_bug.cgi?id=1473 Summary: Add option to save PID of a backgrounded ssh process Classification: Unclassified Product: Portable OpenSSH Version: 5.0p1 Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: ssh AssignedTo: bitbucket at mindrot.org ReportedBy: tsteiner at nerdclub.net When sending an ssh session to the background, there is no option to save the forked process's PID to a file. This would be very helpful when writing scripts that manage ssh tunnels. An example of such usage would be: ssh user at host -L 123:remote.host:456 -f /var/run/tunnel.pid -N -- Configure bugmail: https://bugzilla.mindrot.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching the assignee of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2008-May-28 19:12 UTC
[Bug 1473] Add option to save PID of a backgrounded ssh process
https://bugzilla.mindrot.org/show_bug.cgi?id=1473 Damien Miller <djm at mindrot.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |djm at mindrot.org --- Comment #1 from Damien Miller <djm at mindrot.org> 2008-05-29 05:12:16 --- You can control a running SSH process using the control socket ssh -nNfL 123:remote_host:456 -MS ~/.ssh/ctl-%r-%h-%p__%l user at host You can ask the master process to exit gracefully using: ssh -S ~/.ssh/ctl-%r-%h-%p__%l -O exit user at host See the ControlPath and ControlMaster documentation in ssh_config(5) for more information. -- Configure bugmail: https://bugzilla.mindrot.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching the assignee of the bug. You are watching someone on the CC list of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2008-May-29 00:11 UTC
[Bug 1473] Add option to save PID of a backgrounded ssh process
https://bugzilla.mindrot.org/show_bug.cgi?id=1473 Darren Tucker <dtucker at zip.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dtucker at zip.com.au --- Comment #2 from Darren Tucker <dtucker at zip.com.au> 2008-05-29 10:10:58 --- You can also do it with some trivial shell scripting: #!/bin/sh echo $$ >ssh.pid exec ssh user at host -L 123:remote.host:456 -f -N -- Configure bugmail: https://bugzilla.mindrot.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching the assignee of the bug. You are watching someone on the CC list of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2008-May-29 15:09 UTC
[Bug 1473] Add option to save PID of a backgrounded ssh process
https://bugzilla.mindrot.org/show_bug.cgi?id=1473 --- Comment #3 from Tim Steiner <tsteiner at nerdclub.net> 2008-05-30 01:09:20 --- Damien: Thanks for the tip. I was unaware of ControlMasters. Darren: Actually, since the ssh process is forking, the pid your script saves is that of the parent process, and not the new child process. I suppose something like this would work: #!/bin/sh echo $$ >pid.sh exec ssh user at host -L 123:remote.host:456 -N The downside is that you have to run it in the background, and ssh won't be able to prompt for a password (if needed). -- Configure bugmail: https://bugzilla.mindrot.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching the assignee of the bug. You are watching someone on the CC list of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2008-May-29 15:10 UTC
[Bug 1473] Add option to save PID of a backgrounded ssh process
https://bugzilla.mindrot.org/show_bug.cgi?id=1473 --- Comment #4 from Tim Steiner <tsteiner at nerdclub.net> 2008-05-30 01:10:49 --- Oops, that should have been ssh.pid above, not pid.sh! -- Configure bugmail: https://bugzilla.mindrot.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching the assignee of the bug. You are watching someone on the CC list of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2009-Dec-22 19:48 UTC
[Bug 1473] Add option to save PID of a backgrounded ssh process
https://bugzilla.mindrot.org/show_bug.cgi?id=1473 Tom Anderson <twic at urchin.earth.li> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |twic at urchin.earth.li --- Comment #5 from Tom Anderson <twic at urchin.earth.li> 2009-12-23 06:48:06 EST --- @Damien: The ControlMaster feature is very cool, but you can't (currently) port-forward with the slaves, so if you're trying to set up multiple port forwardings, it doesn't help. @Darren: Things along this line (including ssh ... & ; echo $!) work in many cases, but crucially, don't work with -f. -f is particularly useful because ssh remains in the foreground until it has completed authentication, so in a script, you can rely on a connection having been made once it returns. What i'd like to be able to do is to write scripts like: echo "Starting port forwarding of A" <SOME SSH COMMAND> echo "Starting port forwarding of B" <SOME SSH COMMAND> echo "Doing lots of things using forwarded port ..." <SOME COMMAND TO CLOSE ALL CONNECTIONS> Whether this is using pid/kill or the ControlMaster mechanism. I think i have an idea - mktemp a directory, then start several independent control master connections, one for each forwarded port, with control paths mktemp'd (or otherwise) in that directory, running with -f. To shut them down, for-loop over the files in the directory and do -O exit to close the connections. It's anything but pretty, but it should work (a classic shell script, then!). -- Configure bugmail: https://bugzilla.mindrot.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching the assignee of the bug. You are watching someone on the CC list of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2009-Dec-26 12:41 UTC
[Bug 1473] Add option to save PID of a backgrounded ssh process
https://bugzilla.mindrot.org/show_bug.cgi?id=1473 --- Comment #6 from Damien Miller <djm at mindrot.org> 2009-12-26 23:41:48 EST --- (In reply to comment #5)> @Damien: The ControlMaster feature is very cool, but you can't > (currently) port-forward with the slaves, so if you're trying to > set up multiple port forwardings, it doesn't help.You are correct that it cannot configure port-forwardings (yet - see bug #1617. I hope to fix this before 5.4), but it does help - it gives you exactly what a pidfile does as afar as being able to control a running daemon.> I think i have an idea - mktemp a directory, then start several > independent control master connections, one for each forwarded port, > with control paths mktemp'd (or otherwise) in that directory, running > with -f. To shut them down, for-loop over the files in the directory > and do -O exit to close the connections. It's anything but pretty, but > it should work (a classic shell script, then!).Yes, this is what I mean. -- Configure bugmail: https://bugzilla.mindrot.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching the assignee of the bug. You are watching someone on the CC list of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2011-Mar-02 19:46 UTC
[Bug 1473] Add option to save PID of a backgrounded ssh process
https://bugzilla.mindrot.org/show_bug.cgi?id=1473 Josh Triplett <josh at joshtriplett.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mh+openssh-bugzilla at zugschl | |us.de --- Comment #7 from Josh Triplett <josh at joshtriplett.org> 2011-03-03 06:46:50 EST --- *** Bug 1594 has been marked as a duplicate of this bug. *** -- Configure bugmail: https://bugzilla.mindrot.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching the assignee of the bug. You are watching someone on the CC list of the bug.