| Getting Started with Linux - Lesson 19 |
|---|
More X-Window Tips and Tricks
Starting X on other virtual terminals
With Linux, you are not limited to starting X-window only once. You may open
up another virtual terminal and start another instance of X-window. Remember
though that running two instances will use up a lot of memory.
As we saw in previous lessons, to switch to another virtual terminal, press:
CTRL + ALT + F2 (or F3 up to F6)
Then login as another user and type:
startx -- :1
You can switch between instances of X-Window by typing:
CTRL + ALT + F7 and
CTRL + ALT + F8
Using the X-Window programs from another computer
This is the thing I love to show people from the MS Windows world. I point
to the computer across the room and then say: "Now I am going to start
the browser from that system and make it appear here." You don't need
to be David Copperfield to perform this magic. You only need X-window running
on one and installed on the other. You also need a means of logging in to the
other computer. And here's one more thing. The computer doesn't even need to be
in the same room. It can be in a different room in a different building on a
different continent. Providing your bandwidth is good enough, you can start a
program on a computer 5000 kilometers away and use it on your desktop.
There are two ways to do this. One is not secure and probably
should only be used on a local network, if at all. The second one is very
secure and can be used for trans-oceanic X-window sessions.
If you have the remote login device telnet and the telnet
server installed on the machines, you can use this fairly safely in a local
network. For example, if your workstation is called 'amos' and the other machine
is called 'andy' and you want to use a program on 'andy', sitting at 'amos',
you would type:
xhost +andy
Then with telnet, login into 'amos' (telnet> open amos)
Then, type:
DISPLAY=amos:0.0
then
export DISPLAY
Now you can type the name of any program you want to run that you know is on 'andy'.
Remember though, as I mentioned, telnet is insecure. This are better ways of
doing this. You should never do this if you're working over a
public network, like the Internet.
Remote X sessions with OpenSSH
Open SSH stands for Open Secure Shell. That's just what it is. A
secure shell for logging in at other computers in a secure manner. What goes
over the network is encrypted and your security is not compromised. Most major
distributions will offer this and it is normally installed by default. You may
have to specifically install the OpenSSH server which you need to
have to for this to work on your local network. Using X on another machine,
also known as X forwarding is usually disabled by default so you may
have to edit one file to get this to work locally. If you're doing this across
oceans or continents the configuration will depend on the remote machine. As
long as you have a OpenSSH client and an account on the other machine,
you can do this.
As I mentioned, if you want to do this locally. Here's what you have to
do. Let's use our 'amos' and 'andy' example again. You're sitting at your
workstation called 'amos'. Make sure you have OpenSSH server on
installed on 'andy' and have created a user account there. On 'andy' you need to
login as 'root' and make sure that there is a line in a file called
'sshd_config', usually located in /etc/ssh that says X11Forwarding
yes. If this says X11Forwarding no than you need to change it to
yes. Then you need to restart the OpenSSH server. The easiest
way is to look for its PID by typing: ps ax | grep sshd and killing
it's PID number. Then type: sshd to start the server again.
Then, from 'amos' just connect to 'andy' via SSH, like so:
ssh -l [yourusername] andy
you'll be asked for your password. You log in and then you can run the X
application that you want. It will come up on your desktop on 'amos' courtesy
of 'andy'.
[Previous] [Next]
|