Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

In Ubuntu I'm trying to run the geany editor on my local X display via the command:

 autossh -o StrictHostKeyChecking=false -XCg me@otherDYNDNShost geany &

Trouble is, after the first disconnect & auto re-connect, I have to fg that process to make the (new) geany responsive again, in my local X windows session. Which means that disown from the terminal caused it to get lost into a frozen sleeping state altogether, eventually.

How can I run this truly detached and independent of any terminal/tty?

Appending <&- to the command to cut off STDIN didn't seem to matter either.

share|improve this question
2  
Is it OK after the first disconnect, i.e. on subsequent reconnects will this problem happen again, or not? In the latter case detaching won't really help, maybe tmux or even xpra could help you a lot more here. Also the manual for autossh mentions -f did you try that? –  Max Jan 5 '13 at 12:40
    
tmux/screen may indeed be viable; xpra proved too resource intensive on my lean 1-2GB PCs in the past (behind the scenes X server). In reality before having this problem I was trying to avoid using an ssh layer altogether, just sticking to classic xhost + over port 6000 (i.e. DISPLAY=otherDYNDNShost:0 geany &) but could still not figure out how to re-enable that network port in Ubuntu's X server, not even with DisallowTCP=false in /etc/gdm/custom.conf as researched elsewhere. –  Marcos Jan 5 '13 at 18:50
add comment

1 Answer 1

up vote 1 down vote accepted

Try adding -f to autossh. Description of -f from ssh man page:

Requests ssh to go to background just before command execution. This is useful if ssh is going to ask for passwords or passphrases, but the user wants it in the background. This implies -n. The recommended way to start X11 programs at a remote site is with something like ssh -f host xterm.

If it won't work, try using daemon (http://www.libslack.org/daemon/). In Debian and derivatives package is named daemon. Example:

daemon autossh -o StrictHostKeyChecking=false -XCg me@otherDYNDNShost geany
share|improve this answer
    
Silly me, I tried -f right after posting and that worked, but felt bad about answering myself so fast. Thanks. However what's really annoying (and probably a different question) are its frequent disconnects & restarts, whilst another interactive ssh session seems way more tolerant of network hiccups and stays connected to one session. –  Marcos Jan 5 '13 at 18:38
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.