processes remain after "ssh -X <user>@localhost firefox -no-remote"

Asked by Shahar Or

Dear friends,

I've added a button to my panel so that my partner could access his browser from my session. The button's command is "ssh -X mor@localhost firefox -no-remote" and I'm using RSA keys without passphrase for the ease of it.

Now the problem is when I try to shut down the system. It then tells me that there are processes running which aren't mine.

Turns out that there are three processes which belong to my partner running after he closed his Firefox. These are:
mor 16396 0.0 0.1 8912 1912 ? S 19:25 0:04 sshd: mor@notty
mor 16440 0.0 0.0 3144 804 ? S 19:25 0:00 dbus-launch --autolaunch e046da5c053ac3c9ab16f2f949d13142 --binary-syntax --close-stderr
mor 16444 0.0 0.0 2672 764 ? Ss 19:25 0:00 //bin/dbus-daemon --fork --print-pid 5 --print-address 7 --session

How can I avoid having these processes running after my partner's Firefox finishes, please?

Many blessings.

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Steven Danna (ssd7) said :
#1

This isn't really a solution, but try the following for diagnostic purposes(see paragraph below steps for a description of what I think is happening):

1) Create a file in the user's home directory with the following (I pulled part of this from the dbus-launch man page):

#!/bin/bash
if test -z "$DBUS_SESSION_BUS_ADDRESS" ; then
             eval ‘dbus-launch --sh-syntax --exit-with-session‘
fi
/usr/bin/firefox -no-remote

2) Make this file executable (chmod +x filename.sh)
3) Now instead of the link you set up, ssh into the machine as the user but do the following:

ssh -X mor@localhost ./filename.sh

Basically, sshd is sticking around because the two processes are running, if we can get rid of those two processes, sshd dies. I think what is happening is that firefox is autostarting the dbus-daemon (hence the dbus-launch process). since dbus-daemon is a child process of dbus-launch, dbus-launch isn't going away until dbus-daemon goes away, and dbus-daemon isn't going to go away because dbus-launch wasn't called with --exit-with-session. This is just the theory I came up with after reading the dbus-launch man page, so it could be entirely off base. What the directions above hope to do is preemptively start dbus-launch with the --exit-with-session parameter, thus, when you close firefox and end your session, dbus will actually exit. That is, if that script does what I think it should do. :-)

If you have the time to try this out, please post back with any results.

Revision history for this message
Shahar Or (mightyiam) said :
#2

Dear Steven,

Look:
dawn@dawn-desktop:~$ ssh -X mor@localhost '~/.firefox-remote'
DBUS_SESSION_BUS_ADDRESS='unix:abstract=/tmp/dbus-icAoNFOkEg,guid=e194c236d93dee4c9b5df5474a44d0f8';
export DBUS_SESSION_BUS_ADDRESS;
DBUS_SESSION_BUS_PID=30413;
DBUS_SESSION_BUS_WINDOWID=142606337;

firefox starts and I close it and dbus still runs. I press <Ctrl>+C to stop it and then 'exit' to close the ssh session.

Many blessings.

Revision history for this message
Steven Danna (ssd7) said :
#3

OK. So I guess my script didn't work right. What happens if you do the following:

ssh -X mor@localhost dbus-launch --exit-with-session --binary-syntax firefox -no-remote

or

ssh -X more@localhost dbus-launch --binary-syntax firefox -no-remote

Revision history for this message
Steven Danna (ssd7) said :
#4

If we don't end up figuring out a solution to this, I suppose it would
always be possible to write a script that kills dbus after firefox
returns and then simply have your link run that script--but that hardly
seems optimal.

You may want to respond to this simply so that your question gets put
back into an open state, making it more likely that somebody will see
it.

Revision history for this message
Shahar Or (mightyiam) said :
#5

> ssh -X mor@localhost dbus-launch --exit-with-session --binary-syntax firefox -no-remote
does the same. I have to <Ctrl>+C it.

> ssh -X more@localhost dbus-launch --binary-syntax firefox -no-remote
with this, after I close firefox, I get a prompt but dbus is running in the bg.

I've linked this to LP#392543 .

Can you help with this problem?

Provide an answer of your own, or ask Shahar Or for more information if necessary.

To post a message you must log in.