Often I want to do some quick administration on a box of mine but don't really feel like running a VNC session (aka slow) just to do it. That's where forwarding X comes in real handy. Our prerequisites are 1) an understanding of what SSH and X Windows is/does 2) having those tools at your disposal, and 3) the remote machine must be able to forward X.
Say for instance on our remote machine there is an X application that we want to run on our local machine without needing VNC. Well, first, fire up the terminal. We want to SSH (secure shell) into our machine.
ssh -X username@hostname-ip
After you enter your password, we are just about there. Now that we are into the remote machine, all that is necessary is to run our X app. As an example I'll use xclock.
xclock &
You should see the X application (in my case xclock) run as if a native app on your machine. The only difference is, it is running on the remote machine and being displayed locally.
We can take this a step further and run multiple applications at the same time with the nohup command. Using nohup we can run any of our X applications through the terminal and send them into the background while we execute another. For example, for some really strange reason I want to forward xclock and glxgears at the same time over SSH. Here's how we make that happen.
nohup xclock &
nohup glxgears &
Now we have both X applications being displayed on my local desktop. It is important to remember though that since we are running X applications nohup will not send them into the background in the same fashion as running a script would; once we close our terminal they will no longer run.
Obviously there are a ton of different uses for this and even more command-line options. Most of it is way out of the scope of this post. I always suggest checking out the man pages first.
man ssh
man nohup
thanks for sharing ! really
thanks for sharing ! really useful information !
Post new comment