Often it is necessary to log into a computer remotely, for example to run a program such as MEDx (which runs only on kryten). You can use telnet or ssh. (From a Windows PC for example, you can open a DOS prompt and telnet.)
If you are going to display any graphics from the remote computer to the computer that you are using, first run the xhost command. After logging in, you may then need to set the DISPLAY environment variable. (See below for details.)
[marvin: lewis]$ ssh kryten lewis@kryten's password: Last login: Wed Oct 8 13:58:31 2003 from marvin.rfmh.org Have a lot of fun... [kryten: lewis]$or
[marvin: lewis]$ telnet kryten Trying 10.76.253.10... Connected to kryten. Escape character is '^]'. Welcome to SuSE Linux 7.3 (i386) - Kernel 2.4.10-4GB (4). kryten login: lewis AFS Password: Last login: Thu Oct 2 15:54:38 from 10.76.253.244 Have a lot of fun... [kryten: lewis]$
It is possible to log into a Linux workstation from a Windows PC. From the Start menu, choose "Run..." and type "telnet <computer_name>", for example "telnet kryten". To log out, type control-D or type "exit". In older versions of Windows such as Windows 95, telnet is somewhat buggy, but it is still useful for limited tasks such as listing directories. Note that telnet has been disabled on all our workstations except for kryten. Other programs such as SecureCRT let you open a secure ssh connection. Note that you will not be able to display graphics from the Linux workstation onto your Windows PC unless you have X Server software running on your PC.
If you login to a computer remotely and want to display graphics on the computer that you are using, you must first use the xhost command on the computer that you are using to give permission to the remote computer to display graphics there. Also the DISPLAY environment variable may need to be set on the remote computer to tell it where to display.
From marvin, give permission to kryten to display graphics on marvin:
[marvin: lewis]$ xhost kryten kryten being added to access control list
Next, login to kryten:
[marvin: lewis]$ ssh kryten lewis@kryten's password: Last login: Wed Oct 8 14:28:19 2003 from marvin.rfmh.org Have a lot of fun... [kryten: lewis]$
Check that the DISPLAY environment variable is set correctly, so when you display graphics they will appear on marvin:
[kryten: lewis]$ printenv DISPLAY kryten:10.0
This is set correctly - graphics to be displayed will be tunneled from kryten through ssh to the computer marvin. However, MEDx cannot handle this type of specification of DISPLAY. (You can start MEDx, but it will give errors and not display images properly.) So if you want to use MEDx, reset DISPLAY to something which MEDx can handle:
[kryten: lewis]$ export DISPLAY=marvin:0.0 [kryten: lewis]$ printenv DISPLAY marvin:0.0
With this specification of DISPLAY the graphics will be sent over the network via the normal X Windows protocol, which MEDx can handle.
Notes:
Sometimes it is useful to login to a Linux computer without the graphical desktop environment KDE - for example to terminate a program when KDE seems to be frozen. If your home directory is full, you cannot log into KDE, since files need to be written or modified in your home directory; in that case it is also useful to login to a virtual console.
You can open a virtual console by pressing control-alt-F1, control-alt-F2, ... or control-alt-F6. Then you can login at the prompt and terminate any hung programs or free up space in your home directory. You can get back to the graphical screen with control-alt-F7. Remember to log out of the virtual console before you leave.
Sometimes a program hangs but the computer is not crashed, and you can fix the problem by stopping the program. If you can still login remotely or login to a virtual console, use the ps or top commands to determine the process ID for the program that you want to terminate. Then use the kill command to terminate the program.
[marvin: lewis]$ ps aux |grep -v root USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND bin 331 0.0 0.1 1344 536 ? S Sep19 0:00 /sbin/portmap at 377 0.0 0.1 1444 600 ? S Sep19 0:00 /usr/sbin/atd lp 459 0.0 0.1 1952 844 ? S Sep19 0:00 lpd Waiting lewis 22642 0.0 0.2 2508 1244 ? S 13:41 0:00 /bin/bash --login /usr/X11R6/bin/kde ... lewis 22975 99.9 2.7 23300 14116 ? S 14:53 0:01 /opt/netscape/netscape ...
For some unknown reason netscape is using 99.9% of the CPU time. The process ID (PID) is 22975. Now terminate the process:
[marvin: lewis]$ kill -9 22975
Be sure to run the 'ps' or 'top' command again to ensure that the program has been terminated, and that no other processes have suddenly taken over most of the computer's resources.
Note: If you use the -f switch to the 'ps' command (for example 'ps -ef |grep -v root'), the parent process ID (PPID) will also be listed. The PPID of a process is the PID of the process that spawned it. This can be useful
Sometimes a computer gets hung and you can't log out normally from the graphical desktop environment KDE. If you can login remotely or login through a virtual console, run the ps or the top command to find the process ID (PID) of the process "/usr/X11R6/bin/kde". Then terminate that process using the kill command.
[marvin: lewis]$ ps -ef |grep "/usr/X11R6/bin/kde" lewis 22642 22450 0 13:41 ? 00:00:00 /bin/bash --login /usr/X11R6/bin/kde [marvin: lewis]$ kill -9 22642
Hopefully this will log you out and unfreeze the computer. If not, try terminating other programs, or contact the CABI system administrator (Dave Lewis).
| This page was last updated on 1/28/2008. |