Can't unset close-on-exec flags on Ubuntu 12, ssh 5.9p1
My system is Ubuntu 12 LTS. that is using OpenSSH_5.9p1 ( Debian-5ubuntu1, OpenSSL 1.0.1 14 Mar 2012 ). I tried this
solo -port=1234 ssh remote -fN
to create a stable tunnel to the remote server. Unfortunately, when ssh is executed, it seems to ignore / modify the variable $^F, so that
solo -port=1234 ssh remote -fN # will execute ssh
solo -port=1234 ssh remote -fN # will execute ssh
will launch two different ssh connections / processes on my system (the expected result should be one)
This problem happens only with ssh. If I use ping 0 instead,
solo -port=1235 ping 0 # will execute ping
solo -port=1235 ping 0 # wil exit
the program solo seems to work well.
I don't encounter this issue with ssh on Ubuntu 10 LTS and Ubuntu 11.
As a work-around, I have to use the wrapper for my ssh command
#!/bin/bash
# wrapper.sh
ssh remote -N
I also note that I can't use -f inside the wrapper, nor use exec ssh remote -N there.
Since OpenSSh 5.6p1, ssh client closes all file descripts from the parent! And your script won't work
20100816
- (dtucker) [configure.ac openbsd-compat/Makefile.in
openbsd-compat/openbsd-compat.h openbsd-compat/strptime.c] Add strptime to
the compat library which helps on platforms like old IRIX. Based on work
by djm, tested by Tom Christensen.
- OpenBSD CVS Sync
- [email protected] 2010/08/12 21:49:44
[ssh.c]
close any extra file descriptors inherited from parent at start and
reopen stdin/stdout to /dev/null when forking for ControlPersist.
prevents tools that fork and run a captive ssh for communication from
failing to exit when the ssh completes while they wait for these fds to
close. The inherited fds may persist arbitrarily long if a background
mux master has been started by ControlPersist. cvs and scp were effected
by this.
"please commit" markus@
- (djm) [regress/README.regress] typo
I've written my own version in Ruby https://github.com/icy/rolo :D