This section will assist you in making telnet or ssh terminal connections to a Unix/Linux system work properly, especially if you connect to Unix from machines running Microsoft operating systems. Some (all?) versions of Microsoft's telnet client do not pass on information about the connection to the remote Unix system, leading to problems.
Warning! If you do not follow the three basic rules in this document, you may lose data on the Unix machine if you try to edit using a full-screen editor (such as vi)!
If you are connecting from Linux to Unix (e.g. from Floppix, Knoppix, or any other Linux distribution to ACADUNIX), you will have fewer problems. If you connect from Linux to Linux, you shouldn't have any problems at all.
$ stty -a $ /usr/bin/X11/resize $ TERM=vt100 $ export TERM $ stty erase '^H' $ stty erase '^?'
You need to configure your telnet client and the remote Unix terminal so that full-screen programs such as vi know the size of your telnet window and the type of terminal emulator you are using. This section should help solve problems and errors such as the following:
ex: 0602-108 unknown is not a recognized terminal type. ex: 0602-108 linux is not a recognized terminal type. ex: 0602-108 ANSI is not a recognized terminal type. ex: 0602-127 Visual mode requires more cursor capability than the terminal provides. WARNING: terminal is not fully functional Terminal entry not found in terminfo 'linux' not known. Available builtin terminals are: [...list...] defaulting to 'ansi'
If you get errors similar to the above, or if vi is not redrawing the screen correctly, read on...
You must check these three things every time you connect to Unix:
After you start telnet and before you type in your login userid and password to the remote Unix system, make sure your telnet session is configured correctly. Here are the things you must verify in telnet on your Windows machine:
Local Echo: Off Blinking Cursor: your choice Block Cursor: your choice VT100 Arrows: On Emulation: VT100/ANSI Buffer Size: 24 Fonts: your choice of Courier-style font Background Color: your choice
Anything marked "your choice" does not have to be changed. You only need to set these options once and they will be remembered for this computer. (If you change computers, you will have to reset the options!)
If you use the telnet Connect|RemoteSystem dialog box, make sure you use the following settings:
Host Name: acadunix.algonquincollege.com Port: telnet TermType: vt100
Note that the terminal type vt100 is spelled with two lower-case letters followed by the number one hundred. There are no blanks in or around any of these three fields. All the letters are lower-case.
You only need to type in the short name acadunix if you are in an Algonquin College Lab or using a College dial-in phone line. Use the full Internet address (with domain name algonquincollege.com) if you are anywhere else. (Yes, you can telnet to this Unix machine from anywhere in the world, including from your home or work.)
On the Unix side of your connection, once you are logged in, you have to make sure of only two things:
Once you are connected to Unix and have logged in, you need to ensure that Unix knows the size of the telnet terminal window you are using. If your Windows telnet Buffer Size (in the Terminal|Preferences menu) is set to 24, you may not need to do this (but it won't hurt). If your Windows telnet Buffer Size is not 24, you may need to do the command below every time you connect to Unix. (Once you learn how to create a .profile file, you can put these commands into that file for automatic execution every time you log in.)
Use the Unix resize command on Unix to make Unix know the size of your telnet window (the window size is the Windows telnet Buffer Size in the Terminal|Preferences menu). If just typing resize at the Unix prompt doesn't work (if you get "command not found"), you'll have to type the full absolute Unix pathname of the resize command, /usr/bin/X11/resize, so use whichever command line works:
Use either of the above Unix command lines. (It doesn't hurt to type it more than once; but, only once is necessary.) Note the upper-case letter X followed by the number eleven in the full pathname, and remember to use forward slashes and not backslashes. What you should see as output after you type the command into Unix is something similar to the following:
$ resize COLUMNS=80; LINES=24; export COLUMNS LINES;
The number of LINES= may differ for your telnet window. If you do not see this kind of output using either of the above pathnames, check your typing, then consult a lab monitor or instructor.
To use successfully full-screen commands such as vi on Unix, the number of LINES shown in the output of resize must match the Buffer Size given in the Terminal|Preferences menu of your Windows telnet session. Make sure that the number of lines is not bigger than your screen! 24 lines is always safe; sometimes you can use 30 or even 50 if you have a big monitor (or are using small Courier fonts). Start with a telnet Buffer Size of 24.
You can verify the number of lines that Unix thinks your window contains using this command:
Make sure the number of rows is exactly equal to the size of your telnet window.$ stty -a speed 38400 baud; 29 rows; 80 columns ...
When starting the vi text editor, you may see errors similar to the following:
ex: 0602-108 unknown is not a recognized terminal type. ex: 0602-108 ANSI is not a recognized terminal type. ex: 0602-127 Visual mode requires more cursor capability than the terminal provides.
The above errors mean that the terminal type set by telnet for your login session is not recognized on Unix as valid. Do not attempt to use vi or any other full-screen command if you are getting the above errors. Full-screen commands need to know what kind of terminal you are using, to be able to draw on your screen correctly. Fix your terminal type, first.
If you are using a Windows telnet command to connect to Unix, and you get the above errors, you can work around the problem by telling Unix that your terminal type is a vt100. Here's how you can do this at a Korn shell prompt:
The case of the letters is significant, as is the use of spaces. TERM is upper-case; vt100 is two lower-case letters followed by the number one hundred. There are no blanks at all in the first line. There is at least one blank in the second line.$ TERM=vt100 $ export TERM
If you always connect to Unix using a vt100-compatible terminal emulator (such as Windows telnet), you can put the above two lines into your login .profile file for automatic execution every time you log in.
$ cat >out This is a good^H^H^H^H $ cat >out This is a good^?^?^?^?
Unix was designed to handle a wide variety of different terminals that used different backspace key conventions; so, sometimes Unix isn't configured to match your keyboard.
To configure the Unix terminal driver to handle your backspace ("erase") character, use the appropriate stty command. Pick one of the following:
$ stty erase '^?'
or$ stty erase '^H'
The '^?' argument is in single quotes to protect the characters from the shell. There are two separate characters in the quoted string. You can put this command into your login .profile file to execute every time you log in.