Solved

CYGWIN to CentOS GDM over ssh or ssh2

Posted on 2009-05-13
28
1,630 Views
Last Modified: 2013-11-15
I can get the desktop environment in cygwin using xwin.exe -query ip_address .
I think that it is using raw XDMCP.  I want to lock down the servers and only use SSH or better SSH2.  I understand that "you can tunnel XDMCP 'through' SSH".  Do I have that last statement correct?

If so, how do I accomplish this?
0
Comment
Question by:rtod2
  • 12
  • 11
  • 5
28 Comments
 
LVL 16

Expert Comment

by:ai_ja_nai
ID: 24380361
Just connect to the remote box via ssh (with -X option, so that you can forward the X session) and every command you'll start in the xterm will be encrypted
0
 
LVL 16

Expert Comment

by:ai_ja_nai
ID: 24380437
..Unless you want to use XDMCP to get a big window on your Windows desktop with the GNOME/KDE/XFCE desktop insde. That's a whole different story, since XDMCP is a raw protocol that doesn't support any form of encryption. You can actually tunnel the connection by hand, by redirecting UDP port 177 and TCP port 6000 traffic on port 22 on the client side and setting up the "exit" on the server side.
Or you can use a secured VPN, so that you can use the raw XDMCP on a secure channel with no risks
0
 
LVL 16

Expert Comment

by:ai_ja_nai
ID: 24380450

ssh -L localport:remotesite.com:remoteport user@remotesshserver.com

Open in new window

0
 

Author Comment

by:rtod2
ID: 24380932
I'm not understanding.  I may need baby steps here.  I really appreciate the example.  Can I tunnel XDMCP through SSH to the login screen (pre-login) without having an account on the system?

I'm so close I can taste it :)
0
 
LVL 30

Expert Comment

by:Kerem ERSOY
ID: 24381851
Since you talk of CygWin it seems taht you're a regular running Windows Xp / Vista etc...

If you've not done already you'll need ssh for Cygin. To get it
- Run Cygwin Setup
- Browse the available programs list
- Select SSH andwait for it to setup SSH.
- Once the setup is over to access your remote X servers:
- Start your Cygwin
- Start a terminal session through Cygwin.
- Type "ssh -X username@server"
- It will ask password.
- Once you've login to you account.
- Type
   gnome-session &
for gnome
   kdestart &
for KDE to appear on your screen.

Good Luck,
K.
0
 
LVL 30

Expert Comment

by:Kerem ERSOY
ID: 24381874
SSH is located in this menu through Cygwin Setup:
Net > openssh
         openssl
0
 

Author Comment

by:rtod2
ID: 24384864
When you run the setup for xcygwin, the second path it asks for is "where to place the files you are downloading".  I chose a path for that and then copied the folder to a thumb drive.  To run xcygwin, I opened the folder now on the thumb drive, modified the existing cygwin.bat file to include the correct paths, and ran the cmd: xwin.exe -query ip_address from within it.

If I understand you correctly, you are saying that the setup did not copy the required ssh stuff to the folder, correct?

In the Windows world, setup implies registry settings and pre-existing file modifications.  I assume that in this scenario, the setup.exe program simply extracts the files to a folder, correct?
0
 
LVL 30

Expert Comment

by:Kerem ERSOY
ID: 24385043
> If I understand you correctly, you are saying that the setup did not copy the required ssh stuff to the
> folder, correct?

Exactly openssh and openssl are not installed by default so yu need to pick them explicitly to get them installed.

- Once you've got them installed all you'd do is to start XWin either form the Install folder or starting CygWiin and calling xinit.
- Once your X session is opened place the mouse over the console area so that you will be able to type in it.
- execute
ssh -X  root@remote_system_name_or_ip
- enter your password and you're not in the remote system.
- execute
gnome-session &
 at command prompt and now your session must be displayed on your CygWin screen.

I'm writing this message over a CygWin session just as I described above.


0
 
LVL 30

Expert Comment

by:Kerem ERSOY
ID: 24385044
> If I understand you correctly, you are saying that the setup did not copy the required ssh stuff to the
> folder, correct?

Exactly openssh and openssl are not installed by default so yu need to pick them explicitly to get them installed.

- Once you've got them installed all you'd do is to start XWin either form the Install folder or starting CygWiin and calling xinit.
- Once your X session is opened place the mouse over the console area so that you will be able to type in it.
- execute
ssh -X  root@remote_system_name_or_ip
- enter your password and you're not in the remote system.
- execute
gnome-session &
 at command prompt and now your session must be displayed on your CygWin screen.

I'm writing this message over a CygWin session just as I described above.


0
 

Author Comment

by:rtod2
ID: 24385375
Kereme,
Thank you very much for the information about how to start both KDE and GDM dashboards from the cmd window, via SSH.  This was definitely in my list of things to figure out.  I also understand that cygwin will run 'rootless' where separate x11 GUI's can appear outside of the windows framework, and directly on your windows desktop.  This is fascinating!

The ability to start KDE and GDM without being dumped into them from the login GUI is something I did not know was possible.  This is fantastic information!

The purpose of the above question was in reference to a project I am working where I am to demo something called OpenVZ.  Some folks may be used to seeing the login GUI as well though.  I'm looking to see that as well, over ssh.
0
 

Author Comment

by:rtod2
ID: 24385378
Kereme,
Thank you very much for the information about how to start both KDE and GDM dashboards from the cmd window, via SSH.  This was definitely in my list of things to figure out.  I also understand that cygwin will run 'rootless' where separate x11 GUI's can appear outside of the windows framework, and directly on your windows desktop.  This is fascinating!

The ability to start KDE and GDM without being dumped into them from the login GUI is something I did not know was possible.  This is fantastic information!

The purpose of the above question was in reference to a project I am working where I am to demo something called OpenVZ.  Some folks may be used to seeing the login GUI as well though.  I'm looking to see that as well, over ssh.
0
 

Author Comment

by:rtod2
ID: 24385460
Kereme, I must admit that I am a little unclear on your last post.  Thank you very much for taking the time to explain it to me.
0
 
LVL 30

Accepted Solution

by:
Kerem ERSOY earned 500 total points
ID: 24386179
Ok this is another story:

Please check this document and follow instructions to enable your remote X system accpt GDM queries:

http://www.tldp.org/HOWTO/XDM-Xterm/config.html#XDM-XSERV

 
0
 

Author Comment

by:rtod2
ID: 24388064
ai_ja_nai ,
Can you add to this.  I'm still a little unclear on your information?
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 16

Expert Comment

by:ai_ja_nai
ID: 24392925
Tell me what confuses you
0
 
LVL 30

Expert Comment

by:Kerem ERSOY
ID: 24393744
@rtod2:
> ai_ja_nai ,
> Can you add to this.  I'm still a little unclear on your information?

ai_ja_nai's suggestion of redirecing port UDP:177 over the SSH is useless. Since SSH only allows the redirection of TCP ports. Not the UDP ports.

if you use ssh -X switch it will automatically redirect TCP:6000 to your local machine.

But if you want to get the login prompt from your local machine you'll need to use XDM / GDM to your local machine which will use a random port each time you want to connect so it is not possible to automate it through SSH.

Also you told every process is running on its own window instead of systems own desktop. This happens when you start Cygwin from the  Cygwin-X > X-Win Server.

If you start it as:
Cygwin > Cygwin bash Shell
then you type
xinit
from the command console you get and do SSH over the console provided you get your remote session in its own desktop instead of independent windows.

As I told earlier this wont help you to get a klogin prompt on your local X on your local Cygwin. You can only have it when you run xdm / Gdm. I've already given you the instructions to enable them in the message {ID: 24386179} in this tread.

Cheers,
K.
0
 
LVL 30

Expert Comment

by:Kerem ERSOY
ID: 24393833
Here's an excerpt from "Linux XCMP HOWTO":

Using XDMCP is inherently insecure, therefore, most of the distributions shipped as it's XDMCP default turned off. If you must use XDMCP, be sure to use it only in a trusted networks, such as corporate network within a firewall. Unfortunately, XDMCP uses UDP port 177 and TCP port 6000; therefore, it is not natively able to use it with SSH. Currently, SSH1 and SSH2 are not implemented to securely forward the UDP communication.

check the whole document here it als oincludes a reference to the document I've sent you:

http://www.faqs.org/docs/Linux-HOWTO/XDMCP-HOWTO.html
0
 

Author Comment

by:rtod2
ID: 24396357
KeremeE  I'm still a little lost.  Perhaps I could call you via skype or something?
0
 
LVL 30

Expert Comment

by:Kerem ERSOY
ID: 24396384
its ok :) But I don't know if its allowed to send my skype over here :)
0
 

Author Comment

by:rtod2
ID: 24397878
So to have everything recommended in the cygwin manual, and additionally to test your suggestions, I need the following:

x11
X-start-menu-items (xinit will be selected automatically)
xorg-docs
xorg-server


I also need inetutils, openssh, openssl  but am having trouble navigating to those.



0
 
LVL 30

Assisted Solution

by:Kerem ERSOY
Kerem ERSOY earned 500 total points
ID: 24401003
oh ok.

Run Cygwin Setup (Called setup.exe) that you'd initially used for setup. Run setup.exe not Cygwnin programs from the Program menu.

Once you launch it will open a small windows and the title will be "Cygwin Setup". Click Next >
Click Install from Internet and Click Next>
There's no need to chence Root Directory so Click Next >
There's no need to change Local Package Directory too so Click Next >
Click Direct Connection and Click Next >
Then it will download some list for a while and launch Dowlooad Site Selection. pick one and click Next >
It will update the downloads list for some time and then launch "Select Packages"

Locate All >
Locate Net and expand it by clicking the small plus sign preceding Net
Select: openssh, openssl, openssl097
To select you'll click over the Skip label. it will change to a version when selected
Locate X11 and expand it by clicking the small plus sign preceding X11
Select xterm, xorg-server: X.Org X Servers, xclpboard. xauth. twm

When you're done Click Next > and wiat till the setup is done. When finished Click Finish.

Now you've downloaded what you need.

Launch  Cygwin, Start > All Programs > Cygwin > Cygwin Bash Shell

When the console launches type "startx -clipboard" and you'll have your X started.
Bring your mouse over the small wite console and type:

ssh -Y root@ip.of.x

when prompted enter your remote root password.
when you see the remote prompt type gnome-session  &
Now you're done.

It you want to launch X-Terminal as your graphic console so that you need to follow GDM enabling comments that I've previously posted above. I've personanlly checked the settings and I know they work.

If you have other questions let me know.

Cheers,
K.
0
 

Author Comment

by:rtod2
ID: 24415132
oh geez!
0
 

Author Comment

by:rtod2
ID: 24415164
X-11 packages - selecting the packages below should auto-select, xauth, xinit, xorg-server, xterm, and others

X-start-menu-icons
twm
xclipboard
xorg-docs

Net packages  selecting the packages below should auto-select openssl and others

inetutils
openssh
openssl097

What is the procedure for bringing up a 'rootless' window?
0
 
LVL 16

Expert Comment

by:ai_ja_nai
ID: 24419255
..rootless..?
0
 
LVL 30

Expert Comment

by:Kerem ERSOY
ID: 24419493
I guess you mean running in multiwindow mode instead of single screen. This is similar to that when you  launch cygwin-x from the Windows menu. It is simle:

You launch windows with a command like:
xinit
startx
XWin
X

When you launching the X, if you the switch -multiwindow then it will run in multi window mode each application will be run in a window over the host OS. This mode is especially good and faster if you are connecting via WAN as it would not require the redrawing of the window manager items.

An1ther useful switch is -clipboard it means that Cygwin will share its clipboard with windows so you'll be able to cut and paste.

Cheers,
K.
0
 
LVL 30

Expert Comment

by:Kerem ERSOY
ID: 24422179
Hi rtod2 please post here if you have other questions. I'm also updated my info so that I have my msn messenger addy in my info : )
0
 

Author Comment

by:rtod2
ID: 24423295
New question posted here http://www.experts-exchange.com/Software/CYGWIN/Q_24418971.html  prior to your request.  Is that an OK spot?  I very much appreciate your assistance.
0
 

Author Comment

by:rtod2
ID: 24423691
Kereme  I have no way of accessing your MSN from here.  Please find my information in my profile as well.  I'd very much like to get in touch via email.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Workplace bullying has increased with the use of email and social media. Retain evidence of this with email archiving to protect your employees.
In this article, you will read about the trends across the human resources departments for the upcoming year. Some of them include improving employee experience, adopting new technologies, using HR software to its full extent, and integrating artifi…
This video demonstrates how to use each tool, their shortcuts, where and when to use them, and how to use the keyboard to improve workflow.
Viewers will learn how to use the Hootsuite Dashboard.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now