You are not logged in.

#1 2014-03-09 17:46:56

panac
Member
Registered: 2014-03-09
Posts: 12

Keeping X apps running after closing ssh session

edit: this problem is a bit different to what I thought it was, see my post further down

I'm having a problem...

I have an arch install which i am ssh-ing into using putty on my Windows desktop, where Xming is also running. I then launch X apps via ssh which connect straight to xming over LAN. This works fine.

I would like them to then stay open even after closing the ssh session. Sometimes this works fine for a while, and then it won't for a while.

I have tried using

app &
app &
detach
nohup app &
detach

Also I've tried all of the above from a tmux session, which I then disconnect from (app stays open), and the X clients still quit on closing putty.

Sometimes even the first works but others none of them do. Does anyone know why this might be? I'm guessing it isn't anything to do with putty or xming so I'm guessing it's ok to ask here!

Thanks

Last edited by panac (2014-03-09 21:07:38)

Offline

#2 2014-03-09 18:44:59

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,534
Website

Re: Keeping X apps running after closing ssh session

Have you tried setsid?  I don't ssh regularly, and never through putty, but setsid should be just what you need.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2014-03-09 18:59:38

panac
Member
Registered: 2014-03-09
Posts: 12

Re: Keeping X apps running after closing ssh session

Thanks for the idea, I hadn't thought of that. For some reason it still doesn't work though :s

smth@arch ~ % export DISPLAY=winpc:0.0
smth@arch ~ % (setsid urxvt &)
smth@arch ~ % pstree
systemd─┬─accounts-daemon───2*[{accounts-daemon}]
        ├─at-spi-bus-laun─┬─dbus-daemon
        │                 └─3*[{at-spi-bus-laun}]
        ├─at-spi2-registr───{at-spi2-registr}
        ├─colord───2*[{colord}]
        ├─2*[dbus-daemon]
        ├─dbus-launch
        ├─dconf-service───2*[{dconf-service}]
        ├─dhcpcd
        ├─gdm─┬─gdm-simple-slav─┬─Xorg
        │     │                 ├─gdm-session-wor─┬─gnome-session─┬─gnome-settings-───4*[{gnome-settings-}]
        │     │                 │                 │               ├─gnome-shell───5*[{gnome-shell}]
        │     │                 │                 │               └─3*[{gnome-session}]
        │     │                 │                 └─2*[{gdm-session-wor}]
        │     │                 └─2*[{gdm-simple-slav}]
        │     └─2*[{gdm}]
        ├─mission-control───2*[{mission-control}]
        ├─nginx───nginx
        ├─polkitd───5*[{polkitd}]
        ├─pulseaudio
        ├─pulseaudio───2*[{pulseaudio}]
        ├─rtkit-daemon───2*[{rtkit-daemon}]
        ├─sshd───sshd───zsh───pstree
        ├─systemd───(sd-pam)
        ├─systemd-journal
        ├─systemd-localed
        ├─systemd-logind
        ├─systemd-udevd
        ├─udisksd───4*[{udisksd}]
        ├─upowerd───2*[{upowerd}]
        ├─urxvt───zsh
        └─vmtoolsd
smth@arch ~ % exit

urxvt still quits as soon as I close putty

Offline

#4 2014-03-09 19:18:05

rebootl
Member
Registered: 2012-01-10
Posts: 431
Website

Re: Keeping X apps running after closing ssh session

I don't know either putty nor xming. But thinking of ssh and X11 forwarding what you do when starting an X application through ssh is you tunnel it.
I'm not an expert on this but I think the connection get's encrypted by ssh.

So, when the tunnel goes away (closing putty) the connection can not exist.


Personal website: reboot.li
GitHub: github.com/rebootl

Offline

#5 2014-03-09 19:20:27

panac
Member
Registered: 2014-03-09
Posts: 12

Re: Keeping X apps running after closing ssh session

I'm not forwarding X11 over ssh, DISPLAY is the actual IP of my Windows machine eg. 192.168.1.2:0.0 so that after being launched, the clients should be attached to the X server independently of ssh (hence why I'm so confused)

Offline

#6 2014-03-09 19:56:02

panac
Member
Registered: 2014-03-09
Posts: 12

Re: Keeping X apps running after closing ssh session

Just to confirm this is not to do with putty or xming, I loaded up an Ubuntu live CD. Exactly the same thing happens when I SSH into Arch from a terminal on Ubuntu, open an X application on the Ubuntu X server, and then exit the SSH.

edit: this has gotten weirder, I really don't understand what's going on...

1) If I log in via SSH and run screen, run top, detach, and then log out of SSH, screen is killed
2) If I log in just to the console of arch locally and run screen, then log out, it stays running
3) If I log in to the console locally and run an X app on the remote display just backgrounding with .. &, then log out, it stays running
4) If I log into an X session via GDM on arch, or log into the console first and just run xinit, and then open a terminal on the desktop and launch a X app on the remote display, then log out of the desktop, the app is killed
5) If I do the same as in 4) but just run screen and top from a terminal on the desktop, then log out, screen stays running

Any ideas? Maybe a mod could move this out of the newbie forum please!

Last edited by panac (2014-03-09 20:49:16)

Offline

#7 2014-03-09 20:57:05

nomorewindows
Member
Registered: 2010-04-03
Posts: 3,362

Re: Keeping X apps running after closing ssh session

How about trying xpra-winswitch from the AUR?  It runs on Linux and Windows.


I may have to CONSOLE you about your usage of ridiculously easy graphical interfaces...
Look ma, no mouse.

Offline

#8 2014-03-09 21:05:50

panac
Member
Registered: 2014-03-09
Posts: 12

Re: Keeping X apps running after closing ssh session

Thanks for the idea but xpra isn't really related to this problem because I am not closing the X server, and the issue isn't just for X programs like in 1) in my post above. Also xpra is killed when run from SSH just like everything else on logout anyway.

Offline

#9 2014-03-09 21:09:38

nomorewindows
Member
Registered: 2010-04-03
Posts: 3,362

Re: Keeping X apps running after closing ssh session

panac wrote:

Thanks for the idea but xpra isn't really related to this problem because I am not closing the X server, and the issue isn't just for X programs like in 1) in my post above. Also xpra is killed when run from SSH just like everything else on logout anyway.

There's a way to enable user xpra sessions in systemd.


I may have to CONSOLE you about your usage of ridiculously easy graphical interfaces...
Look ma, no mouse.

Offline

#10 2014-03-09 21:20:25

panac
Member
Registered: 2014-03-09
Posts: 12

Re: Keeping X apps running after closing ssh session

Sorry but it is irrelevant and doesn't solve my problem.

Offline

#11 2014-03-09 23:00:37

MW
Member
Registered: 2007-07-27
Posts: 127

Re: Keeping X apps running after closing ssh session

Have you tried using screen?

Last edited by MW (2014-03-09 23:01:56)

Offline

#12 2014-03-09 23:01:57

panac
Member
Registered: 2014-03-09
Posts: 12

Re: Keeping X apps running after closing ssh session

MW wrote:

Have you tried using screen or nohup?

Yes, screen is similar, more detail in post #6

Last edited by panac (2014-03-09 23:44:45)

Offline

Board footer

Powered by FluxBB