LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Password
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.

Notices


Reply
  Search this Thread
Old 03-03-2017, 11:32 AM   #1
mageician
LQ Newbie
 
Registered: Mar 2017
Posts: 2

Rep: Reputation: Disabled
X11Forwarding problem when xauth cannot write to /home mounted via NFS


In our organization we use about a hundred openSUSE clients connected to one central server that acts as file and authentication server (let's call this machine "mainserver"). Home directories for all users are mounted via NFS on the local clients. One of these clients acts as a gateway and allows users to log in using SSH to do some work etc. The use case at hand now is that a user want to connect from an outside machine with X11-forwarding to this gateway machine, and I am pretty sure I have narrowed down the reason it does not work to the following: xauth normally writes an .Xauthority file to the home directory when handling sessions. However, since sshd is run as root@gateway it doesn't have permissions to read/write files in the home directory of the user on the main server (mainserver:/home/user). I have checked all other settings with X11-forwarding that can cause problems, and the testing outside machine can connect with X11 to the mainserver itself and other machines, that is not the issue.

Now, this could be solved by making all home directories r/w accessible by all, but that is obviously a terrible thing to do from a security point of view. Can any of you think of a workaround so I can make X11-forwarding work?

I am aware of the potential security problems with X11-forwarding in itself.

Thanks in advance! =)
 
Old 03-15-2017, 07:13 PM   #2
rhamel
Member
 
Registered: Sep 2009
Location: Caribbean
Distribution: Slackware 15.0, Proxmox 7.4-17, FreeBSD 13.2
Posts: 70

Rep: Reputation: Disabled
Ok, something here doesn't make sense to me. AFAIK, sshd is ALWAYS run as root.

It's not that root doesn't have write access. The user who is logging onto the target machine is not root.

Have you tried
Code:
ssh -Y target-machine-ip-address firefox
using firefox as a test X-11 program?

I find the -Y option gets around xauth issues nicely.

Also, to get around issues with X-11 forwarding, I normally run vncserver on the target host. That way, you can get a full desktop and let vnc manage the auth issues.

Then, you can use vncviewer to connect to the desktop on the target host, or if you want it encrypted, you can use sshvnc or a ssh tunnel to start the vncviewer on the target machine.

You can run a vnc server using x11vnc or vncserver. There are a couple different ways to do it.

If you don't like vnc, you can probably run xrdp and use rdesktop to connect to that server.

It's easier to get vnc working than plain ol'X-11 forwarding and using ssh, it's more secure too.

I've done vnc various ways over the years, so if you decide to use that, I can point you in the direction of various configs that have worked for me. I set vnc up on every network I have ever managed and it works pretty well. There are other ways to do the same thing, most of which have some kind of security built in. Some of them are pretty cool, but vnc works well enough for me. YMMV.
 
1 members found this post helpful.
Old 03-16-2017, 02:04 AM   #3
mageician
LQ Newbie
 
Registered: Mar 2017
Posts: 2

Original Poster
Rep: Reputation: Disabled
Smile

Thank you for great suggestions Rhamel, especially since no-one seemed to give an answer in this thread - kudos to you!

Regarding sshd: yes it is always run as root, but root on the gateway machine. Since the user's home directory is on another server and only mounted via NFS on the gateway, root@gateway cannot access this home directory, only user@gateway can. Does this make sense, or do you see some way to change that?

As you suggested, for all my tests i used the -Y option since it seemed to be the most permissive, but to no avail (I also tried with -X).

However, your solution to use vnc may be a much better one, thanks for pointing me in that direction. I will try to switch to that solution instead, and if you have some pointers and tips (or links etc) on how to make good configs and/or tweaks for vnc, I would sincerely appreciate it.
 
Old 03-16-2017, 08:55 AM   #4
rhamel
Member
 
Registered: Sep 2009
Location: Caribbean
Distribution: Slackware 15.0, Proxmox 7.4-17, FreeBSD 13.2
Posts: 70

Rep: Reputation: Disabled
A tutorial on using VNC with XDMCP to improve user authentication

https://www.ibm.com/developerworks/l...insvnc/#N101F6
 
Old 03-16-2017, 08:58 AM   #5
rhamel
Member
 
Registered: Sep 2009
Location: Caribbean
Distribution: Slackware 15.0, Proxmox 7.4-17, FreeBSD 13.2
Posts: 70

Rep: Reputation: Disabled
Also, a page describing x11vnc, a vncserver with encryption built in and ssvnc, a vnc viewer with ssh tunnelling built in.

http://www.karlrunge.com/x11vnc/

I have used both of these successfully.
 
Old 03-16-2017, 03:09 PM   #6
rhamel
Member
 
Registered: Sep 2009
Location: Caribbean
Distribution: Slackware 15.0, Proxmox 7.4-17, FreeBSD 13.2
Posts: 70

Rep: Reputation: Disabled
Ok, sorry to be harping on this point. You've probably moved on from this, but I've spent the morning on this thing for another project I've working on.

Ok, so what I've realised (really late in the game for me), is that ssvncviewer comes with a utility called 'tsvnc' which is very useful.

1. it connects to the remote host via ssh.

2. it starts up x11vnc on the remote host as the user who just logged in. Since the user then owns the session, there is no xauth problems.

3. it then starts up a vncviewer session from the local host to the x11vnc session running on the remote host as the same user.

So, on the target host, you just need to have x11vnc in the PATH of the user you will be logging in as. You don't have to set up anything else on the remote server. Well, you need to have sshd running, of course.

Since you are logging in using ssh,you can use ~/.ssh/authorized_keys to avoid entering passwords, which I always prefer.

More detail here http://www.karlrunge.com/x11vnc/ssvnc.html#tsvnc
 
  


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
[SOLVED] Why Is There No Write Access On NFS Mounted Filesystem? rabjac Linux - Enterprise 4 02-10-2015 06:47 AM
Speeding up my KDE with /home mounted via NFS m_dev34 Linux - Desktop 2 01-07-2013 02:15 AM
[SOLVED] NFS share is mounted as read-only even if write permissions are set vofka Linux - Server 2 04-14-2010 06:09 PM
assigning quotas for /home mounted using NFS shishirkotkar Linux - Software 1 05-01-2008 04:24 AM
FC6 broken with NFS-mounted /home directories? skellert Fedora 2 11-02-2006 10:37 PM

LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise

All times are GMT -5. The time now is 04:14 PM.

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