Remote Linux server/machine can be accessed from Mac using X11 port forwarding feature in ssh.
X11, also known as X window system, is a combination of server and client programs which can be used to emulate desktop environment of remote Unix like machine on a local machine. The server program of X window system runs on local machine and the client program runs on remote machine.
The best feature of X11 window system is that it is separated into client and server program, which makes it suitable to use both the programs either on same machine or on different machines. For ex, when you are using a Linux desktop with GUI, both client and server programs are running on the same machine and when you access your remote unix like machine from local machine then the server program of X window system runs on local machine and the client program runs on remote machine.
Separation of client and server programs makes X window system really fast over networked connections as most of the drawing work is handled on the local machine.
X window system can be really complex to use over networked connection as server is on the local machine, which makes it difficult for the client, running at remote machine, to see the server.
ssh provides a feature to handle this complexity, which is known as X11 port forwarding.
X11 port forwarding feature of ssh makes a secure tunnel between client and server programs of X window system, so that they can communicate .
Now let's see how to use this feature of ssh to connect to a remote Linux machine from a Mac.
You need to have an X11 server program on your mac to connect to the remote Linux machine.
X11 app comes default with the Operating system for Snow Leopard users, but it has to be downloaded and installed explicitly on Mountain Lion.
Mountain Lion users can download X11 app from here.
Once app is installed, you will have to perform some configuration changes in ssh server running on remote Linux machine.
Add the following lines to the file
/etc/ssh/ssh_config
ForwardAgent yes
ForwardX11 yes
ForwardX11Trusted yes
After this uncomment/add the following line in
/etc/ssh/sshd_config
file.
X11Forwarding yes
Restart the ssh server on remote machine for changes to take effect.
Now on local machine
Open terminal and execute the following command
ssh -X user@host.com
This will log you in to the remote machine if the keys are set, else, it will ask for password.
After you are logged in
Assuming that the remote machine's desktop environment is GNOME, execute the following
command.
gnome-session
If everything works perfectly, you will be able to see your remote Linux machine GUI on your Mac.
For more info visit.
No comments:
Post a Comment