How to Run a task each time a user login in GDM (killing it at logout)

Asked by Gianluca

Hello,

I'm wondering if someone could be so kind to explain me how to achieve this thing:

When i Login in GDM with username "X" a shell command should be run while loading the desktop and the usual stuff.
The command would be "ssh -qTfnN -D 1080 <email address hidden>" and i need this to estabilish a tunnel to connect to the internet.

Then, when i logout with that username "X", the tunnel should be closed.

I need the tunnel to be estabilished only during the user "X" login in GDM, not at system startup, neither when user "Y" is logged in. That's why i can't use rc.local

thanks for your time, your help is appreciated.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Thanos Koukoulis
Solved:
Last query:
Last reply:
Revision history for this message
Best Thanos Koukoulis (thanosk-gmail) said :
#1

Create a bash file with the command and save it some place (make sure it is executable)

The while logged in as the user you want this command to be executed for
go to System - > Preferences - > Sessions and add this as the things that should be
executed at start up.
These are user specific so it will only be executed for the particular user.

Actually they are stored in /home/{user}/.config/autostart

Revision history for this message
Gianluca (gianlucap) said :
#2

Thanks