Linux - NewbieThis 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!
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've read quite a few articles on this now and I still don't seem to be able to do this so am hoping someone can tell me where I am going wrong...
Centos v7 running in a VM
Cygwin installed on the desktop (fresh install)
I have amended the sshd_config on the VM to :-
Disabled selinux and restarted the sshd daemon.
Within cygwin before making the connection I set:-
Then run startxwin
Within Xwin.exe I run the following and get the error:-
$ ssh -XY email@example.com
X11 forwarding request failed on channel 0
Last login: Tue Jun 2 20:40:44 2015 from 192.168.246.10
Is it something I'm missing?
I'll admit X11 is a weak area for me.
Should be yes - not because it is wrong, but because it is just a little bit better security (it prevents other hosts from making connections to your X server via the external IP number and port).
SELinux will not affect how sshd works for forwarding; and it provides a lot better security.
The "export DISPLAY=:0" should not be used... It may or may not be correct, as starting Xwin.exe should define what the display is... But I don't have Xwin to check that - so it may depend on how Xwin uses that.
Now, on the server, you still need to include the package "xauth". This is because of how sshd works with X forwarding. The sshd server creates a port (prefereably localhost:6010, or whatever the offset is specified - and is identified in the user environment as "DISPLAY=10:0"). Sshd also generates an authorization key that is local to the server and uses xauth to enter it into the users .Xauthority file.
Note: By default the xauth package isn't installed... And this may be the primary reason things don't work.
You're making this MUCH more complicated than it needs to be. There is literally zero setup you have to do to get X11 forwarding working, other than installing an X server on your Windows box and setting DISPLAY on cygwin.
I just installed a CentOS 7 VM this morning, and I just installed an X server on my Windows 7 VM to test it, works fine.
On CentOS 7 - DO NOTHING. Don't change anything, don't modify your sshd_config, you don't need to touch it
On Windows - Install XMing, in Cygwin run "export DISPLAY=localhost:0", and then just "ssh -Y" over and run your X application.
What type of installation did you do on your CentOS machine? If you did a minimal or other CLI installation, you may still need to install some of the X libraries, fonts, etc. for your GUIs to work correctly.
I rebooted the VM which re-enabled selinux, uncommented the following lines from sshd_config:-
Checked xauth was working.
Removed the $DISPLAY variable from the Centos host.
Restarted cygwin and exported $DISPLAY=localhost:0.0
I then ran startxwin and connected to the VM using ssh:-
$ ssh -Y firstname.lastname@example.org
Last login: Tue Jun 2 21:36:59 2015 from 192.168.246.10
/usr/bin/xauth: file /root/.Xauthority does not exist
That always happens at least the first time, and anytime after you delete the .Xauthority file. Though why you have changed the sshd service to allow root logins I don't understand. That is normally disabled.
Then ran virt-manager and success the GUI window opened.
However all the text is  while the icons look OK, the banner across the window states a connection failure.
That depends on xming... I believe you are missing some fonts. The connection failure may be due to not having the virtd service running to support VMs.