Remote Management using SSH and X-Forwarding
Our web server runs SLES 10. Initially we would always remotely control it from VNC, however this used up all of screen real estate and we could not cut and paste code snippets or other information between the local Windows computer and the remote SLES server.
I started using X-Forwarding and found it much easier to manage and control the remote server with it. For users who are running Windows desktops and are planning migration to a OES server this should make the process much easier.
Remotely Managing an OES or SLES server from a Windows PC using SSH and X-Forwarding
The most common way to remotely manage a Linux server is through the use of VNC to control the remote desktop. However this covers most of your screen and doesn’t usually allow cut and paste between MS Windows applications and Linux ones.
An alternative when you don’t need the full Linux desktop is to use SSH and X-Forwarding. X-Forwarding makes the Linux application window appear alongside your Windows ones.
To implement this you will need two free pieces of software:
- SSH client, in this case PuTTY from http://www.chiark.greenend.org.uk/~sgtatham/putty/
- X-Server, Xming from http://www.straightrunning.com/XmingNotes/
It is also possible to set up the applications to run off a memory stick or the network by using portaPuTTY (http://socialistsushi.com/portaputty/) instead of PuTTY, this is a modified version that stores data in the folder instead of the Registry, so it will retain your settings between machines.
Once the programs are downloaded and installed, start Xming from the start menu. It should appear as an icon in system tray.
Open up PuTTY and type the IP or DNS address of the SLES / OES machine in the hostname field.
On left hand side click the “X11” option and tick “Enable X11 Forwarding”
If you wish to reuse session later go back to Session page and give the server a common name, and hit Save.
Click Open to start the SSH session
Login using your account, then try opening a graphical program. The window should now appear locally.
Some benefits of X-Forwarding over VNC:
- You can easily copy and paste text between windows. You can have your Windows text editor by side with your Linux one and copy and paste between them.
- The remote screen doesn’t take up all your desktop space. You can have multiple file browsers or terminals open that are shown alongside other programs, making it easy to follow tutorials and online guides.
- Uses less resources on server than running a complete Nautilus desktop
- Connection is encrypted over SSH
Overall it provides a much more integrated environment than using VNC, and gives the feeling of using a single computer rather than remotely controlling another. This integration facilitates migration to OES and makes managing work flow much easier.
Example of having multiple windows open
(click to view large image)
If you are using a Linux desktop you already have a built-in SSH client and X-Server. To start a session with the server just open a terminal session and type in
ssh -X username@serverNameOrIP
Some useful and commonly used applications to run from shell:
- sux or “su –“: Logs you in as root
- yast2: Server Management
- gnome-terminal: GUI Terminal, use to open multiple terminals
- nautilus –no-desktop –browser:File Browser (If you don’t include the no-desktop it will load the complete standard desktop.)
- gedit: text editor
- top: show busiest processes