PDA

View Full Version : [ubuntu] setting xhost rules at boot...



yurtesen
March 25th, 2012, 05:50 PM
I am able to set xhost at boot in Fedora by editing /etc/gdm/Init/Default and for example add:

/usr/bin/xhost +local:

How can similar be done in Ubuntu? I want that the

/usr/bin/xhost +local:

command is executed when the system is sitting at login prompt.

Paddy Landau
March 26th, 2012, 03:42 PM
Do you want it executed when the computer turns on (before showing the login screen) or after you have logged in?

To execute a command after you have logged in, add the command to .profile in your home folder (this will apply only to you).

To execute a command when you or anyone else logs in, add the command to /etc/profile.

To execute a command before anyone logs in, add the command to either /etc/rc.local or /etc/gdm/Init/Default (I don't know the difference between the two, so I don't know which one is preferable).

yurtesen
March 26th, 2012, 06:11 PM
To execute a command before anyone logs in, add the command to either /etc/rc.local or /etc/gdm/Init/Default (I don't know the difference between the two, so I don't know which one is preferable).

Thank you for the answer, This is the correct answer if ubuntu was using GDM (the Init/Default one). If I put it to /etc/rc.local, I believe it wont work since only the user who starts GDM would have right to change xhost setting.

However, since Ubuntu is using Lightdm at this point. I was looking for something which would work with lightdm. For now, I could solve the issue by giving shell to lightdm, setting DISPLAY=:0 in shell rc file and running su - lightdm -c xhost +local: from the rc.local. This is not quote elegant...