Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question

3 Answers 3

The xhost command needs an active X server to run, it can run at the login screen e.g. when lightdm loads. You can enable it by editing /etc/lightdm/lightdm.conf and adding the line :

display-setup-script=/home/user/bin/xhost.sh

example /etc/lightdm/lightdm.conf file :

[SeatDefaults]
greeter-session=unity-greeter
user-session=ubuntu
display-setup-script=/home/user/bin/xhost.sh

example /home/user/bin/xhost.sh file :

#!/bin/bash
xhost +

it works on Ubuntu 12.04.1 LTS, and it was needed to enable a java application that needed X and was run by tomcat6

share|improve this answer
    
you might need to make the xhost.sh script executable with: chmod +x /home/user/bin/xhost.sh –  George L Nov 2 '12 at 6:25

Edit the file /etc/rc.local (with sudo) and add the command before the last command (exit 0).

share|improve this answer
    
This wont work(and I tried never the less and it doesnt work). Because that script will not have access rights to change that setting at first place. It has to be done as lightdm user? –  yurtesen Mar 26 '12 at 9:24

Add the following line to /etc/xdg/lxsession/LXDE/autostart

xhost +local:
share|improve this answer

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.