Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I have an application which must run at startup, without a user logging in, to manage this I have a user with limited permissions automatically logged on to tty7 and use sudo to run the application. I had this successfully configured once, but when trying to repeat the steps 'exactly' as before I'm running into trouble with the Xserver.
When I try running the application I get the message GTK-WARNING cannot open display. When I switch over to tty7 I see that neither DISPLAY nor Xauthority environmental variables are set.
I originally assumed this was due to not having authority to access the server. I don't know much about X server, but I have googled this and tried all the common suggestions. I've su to root and still can't access the program so the issue isn't with sudo, and I have tried creating an Xauthority file, setting Xauthority to look at root's xauth file, and changing the xhost settings. if I try running either the xhost + or xhost list commands I get errors that say unable to access display "" or display "0.0" (depending on if I try setting DISPLAY first).
I then tried hitting crtl alt f8 to switch back to the original login screen that came up when I booted up and logged in. When I switch to tty7 and run my app with sudo it works fine. So basically everything works so long as a user logs in to gnome, but if gnome isn't logged in I can't access the X server at all. I'm lead to assume that gnome starts something when it boots up that my application is using, or has the Xserver locked until it boots up? I'm suspecting that I'm doing something blatantly stupid here but I can't figure it out, and when I google I just find dozens of responses talking about setting Xhost permissions which I don't think is the problem...
so can someone either tell me what I'm missing or at least give me an idea where on what I should be googling to find the answers.
just updating. it turns out it is an authority issue. I had been trying to copy the /root/.Xauthority file, instead the authority file with the magic number i needed was located in /var/gdm:0.Xauth. so I know that if I set XAUTHORITY=/var/gdm:0.Xauth and DISPLAY=:0.0 I can run my program without logging in.
The problem is I need generic installation instructions. I can't include a script that croppies /var/gdm/:0.Xauth because I don't know that file will exist on every computer. Is there another way to get the correct XAuthority file without hard coding that location?
I have considered trying to add xhost + into the boot up scripts to remove the problem. Unfortunately I don't know what point in the boot up process I would need to place the command, assuming it was possible at all. How horrible would the xhost + command run at boot up ruin a computers security?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.