LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-11-2017, 10:51 AM   #1
MrMeeSeeks
Member
 
Registered: Jan 2017
Posts: 32

Rep: Reputation: Disabled
X won't work with new user


Hi folks.

Well, the subject title is descriptive of what I assume the problem might be anyhow.
So, I created a new user, and it seems like he can't start any GUI-applications - emacs with GUI for example. Instead I get this:

...@---:~$ No protocol specified
Display :0.0 unavailable, simulating -nw


Now this thread on unix.stackexchange suggested running "xhost +" which returns "access control disabled, clients can connect from any host" which I find rather unsettling in its generality, and exporting the DISPLAY which I did, and now it works - "xhost + <name>" though did not seem to do anything usable, although it said "<name> is being added to access control list".
So how can I allow the new user as a new client to X without slaying access control altogether? Like, add permission to access to only a particular user?

Also is there a guide on how to set up new users that covers obvious complications like these? I dread trying to use any network application, and emacs startup suggests this is warranted. Most of what I found so far offers little further information than an introduction to adduser and usermod.
Come to think of it, not that I really have the time to deal with it in depth, but I guess I will have to anyway some day, is there some kind of comprehensive guide on X, which deals with things like configuring it for users, configuring users for usage of it, manually starting, restarting and killing it? Like, apart from reading the entire documentation?

Best regards.

Last edited by MrMeeSeeks; 08-11-2017 at 10:58 AM.
 
Old 08-11-2017, 12:09 PM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,830

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
when you start X usually you need to log in. This GUI by default can only be used by that user. This user has the right to allow others to use this X instance, for example by executing the command xhost.

you may start here: https://en.wikipedia.org/wiki/X_Window_authorization
 
Old 08-11-2017, 12:57 PM   #3
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
What distro are you using? Usually you just add a user and then log into X with that user's credentials. It's not supposed to be difficult.
 
Old 08-11-2017, 01:43 PM   #4
MrMeeSeeks
Member
 
Registered: Jan 2017
Posts: 32

Original Poster
Rep: Reputation: Disabled
I'm using xubuntu.

Quote:
when you start X usually you need to log in. This GUI by default can only be used by that user. This user has the right to allow others to use this X instance, for example by executing the command xhost.
Yes that is what I have understood so far. My problem is: if I use xhost + the return message is "access control disabled, clients can connect from any host" which does not sound like what I want - I want only clients on my host, better still only one particular user to be granted access. However when I ran "xhost + user-name" the return message was "user-name is being added to access control list" but the user still could not use the X server as it seems.

Quote:
Usually you just add a user and then log into X with that user's credentials.
What exactly do you mean by logging into X with that user's credentials?
This post on server fault suggests extracting a hexkey from xauth list to use with xauth add $DISPLAY as the new user. That returned xauth: timeout in locking authority file /home/old-user-name/.Xauthority, which was solved by granting write permissions to that particular file for the new-user - which I'd rather not do. However, is that what you meant by logging into X with that user's credentials? Because it seems like now I used the old-user's credentials.

Further, now I am confused what the proper way to go is: grant access via xhost or authorize via xauth. Worse still, apart from xhost + - which seems to just disable access control altogether - or granting write access to new-user and extracting the hexcode - which seems kind of complicated - I have not found a working solution. I don't really know what to google either.
 
Old 08-11-2017, 04:39 PM   #5
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
Normally when you want to change users you log out of X and log back in as a different user. Each users /home directory contains the configuration files for that user. For instance, if you use gnome3, you click "log out". Then you are back at the log-in screen in gdm3. You click "log in as different user", select the user name you want, enter the password in the box, and it starts the X server for the new user.

You don't really need to do all that other stuff. It's not complicated.
 
Old 08-11-2017, 04:43 PM   #6
Trihexagonal
Member
 
Registered: Jul 2017
Posts: 362
Blog Entries: 1

Rep: Reputation: 334Reputation: 334Reputation: 334Reputation: 334
Log in - issue the startx command.

That's how it's done on BSD anyway.
 
Old 08-12-2017, 02:56 PM   #7
MrMeeSeeks
Member
 
Registered: Jan 2017
Posts: 32

Original Poster
Rep: Reputation: Disabled
Quote:
You click "log in as different user", select the user name you want, enter the password in the box, and it starts the X server for the new user.
Ah now I see.
I was trying to solve all my problems so far in relation to switching user in an xterminal, but I guess this will do for now. Although it is somehow unsatisfying and didn't teach me nothing about X.

Quote:
Log in - issue the startx command.

That's how it's done on BSD anyway.
Same issue, it seems to default to trying to use the .Xauthority-file in old-users home directory which I don't want new-user to have permissions for.
Well I'll just go with the GUI solution for now and try to live with it until I find the time to understand X properly.

Best regards to everyone.
 
Old 08-12-2017, 05:23 PM   #8
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
If you go to a terminal with
Code:
$ CTRL+ALT_F1
and do:
Code:
$ ps aux | grep gdm | awk '{print $2}' | xargs sudo kill $1
then gdm3 should respawn and the greeter screen will reappear. Just log in as the new user. Similarly, if X is not running,
Code:
$ startx &
will bring up the gdm3 greeter screen where you can log in as any user you wish.

It is not useful to leave the xserver running for one user, and execute programs in that session under another user. It's contrary to common sense because of security concerns. And why would anyone need to do that?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Why won´t number keypad work in my user account? ricdave Linux - Desktop 2 08-18-2008 04:05 PM
Connecting to net as a user won't work QuantumPressure Linux - Newbie 3 05-07-2007 04:35 AM
Firefox Won't Work as a Normal User Baryonic Being Linux - Software 3 09-09-2004 02:14 PM
k3b won't work as user Glock Shooter Slackware 4 11-29-2003 01:33 PM
startx won't work as user Mega Man X Slackware 6 07-25-2003 08:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration