From 2237f3e894784c85260493cf0c5d083194a6ea18 Mon Sep 17 00:00:00 2001 From: Murray Stokely Date: Mon, 6 Aug 2001 12:17:47 +0000 Subject: [PATCH] First step of a major overhaul of this chapter. Split into multiple commits to make it slightly easier on the translation teams. * Add a standard synopsis * Remove references to FreeBSD 1.1.5.1 and FreeBSD 1.1. Document the behavior of 4.x / 5.x and ignore the paleontology. * Move s around so that printed output looks better. * Reference other chapters in the Handbook instead of duplicating information. * Rephrase many sentences to be more concise. * -> * Refer to the text as "this chapter" instead of "this document" * Refer to manual pages consistently. * Turns a couple of question and answer entries into more formal paragraphs. * Don't intersperse example commands inside paragraphs as often. Instead, talk about something and then provide an example. * Mark up contributors in . * Remove synopsis-like information from one of the individual sections, since this has been expanded at the front of the chapter. * Mark up keys in * Remove acknowledgments section. This is inappropriate for a book chapter and the acknowledged person has been moved to the as an additional contributor. * Remove "information integrated from FAQ", that describes much of our documentation. * Remove troubleshooting entry about needing to be in a specific group to run tip or cu, since this is no longer the case. PR: 19481 --- .../books/handbook/serialcomms/chapter.sgml | 381 +++++++----------- 1 file changed, 136 insertions(+), 245 deletions(-) diff --git a/en_US.ISO8859-1/books/handbook/serialcomms/chapter.sgml b/en_US.ISO8859-1/books/handbook/serialcomms/chapter.sgml index 2bc17f0519..4518abf07d 100644 --- a/en_US.ISO8859-1/books/handbook/serialcomms/chapter.sgml +++ b/en_US.ISO8859-1/books/handbook/serialcomms/chapter.sgml @@ -1,13 +1,13 @@ Serial Communications - + Synopsis serial communications @@ -17,13 +17,34 @@ terminal consisted of a 10-character-per-second serial printer and a keyboard. This chapter will cover some of the ways in which FreeBSD uses serial communications. + + After reading this chapter you will know: + + How to connect terminals to your FreeBSD + system. + How to use a modem to dial out to remote + hosts. + How to allow remote users to login to your + system with a modem. + How to boot your system from a serial + console. + + + Before reading this chapter you should: + + Know how to configure and install a new kernel () + Understand Unix permissions and processes () + Have access to the technical manual for the + serial hardware (modem or multi-port card) that you would like + to use with FreeBSD. + + Serial Basics - Assembled from FAQ. - This section should give you some general information about serial ports. If you do not find what you want here, check into the Terminal and Dial-up sections of the handbook. @@ -200,9 +221,9 @@ There are a couple of kinds of serial cables. Which one you'll use depends on the terminal you want to connect: + null-modem cable - null-modem cable If you are connecting a personal computer to act as a terminal, use a null-modem cable. A null-modem cable connects two computers or terminals @@ -413,16 +434,18 @@ already configured your kernel to support the serial port to which the terminal is connected—and that you have connected it. - In a nutshell, you need to tell the init - process, which is responsible for process control and initialization, - to start a getty process, which is responsible for + Recall from that the + init process is responsible for all process + control and initialization at system startup. One of the + tasks performed by init is to read the + /etc/ttys file and start a + getty process on the available terminals. + The getty process is responsible for reading a login name and starting the login program. - To do so, you have to edit the /etc/ttys - file. First, use the su command to become root. - Then, make the following changes to - /etc/ttys: + Thus, to configure terminals for your FreeBSD system the + following steps should be taken as root : @@ -432,7 +455,7 @@ - Specify that /usr/libexec/getty be run on + Specify that /usr/libexec/getty be run on the port, and specify the appropriate getty type from the /etc/gettytab file. @@ -459,22 +482,19 @@ As an optional step, you may wish to create a custom getty type for use in step 2 by making an - entry in /etc/gettytab. This document does + entry in /etc/gettytab. This chapter does not explain how to do so; you are encouraged to see the &man.gettytab.5; and the &man.getty.8; manual pages for more information. + + To help illustrate this procedure, we will use a running + example throughout this section. In our example, we will + connect two terminals to the system: a Wyse-50 and a old 286 + IBM PC running Procomm terminal + software emulating a VT-100 terminal. We connect the Wyse to + the second serial port and the 286 to the sixth serial port (a + port on a multiport serial card). - The remaining sections detail how to do these steps. We will use - a running example throughout these sections to illustrate what we need - to do. In our example, we will connect two terminals to the system: a - Wyse-50 and a old 286 IBM PC running Procomm terminal software - emulating a VT-100 terminal. We connect the Wyse to the second serial - port and the 286 to the sixth serial port (a port on a multiport - serial card). - - For more information on the /etc/ttys - file, see the &man.ttys.5; manual page. - Adding an Entry to <filename>/etc/ttys</filename> @@ -491,11 +511,11 @@ port's /dev entry without the /dev part. - When you installed your FreeBSD system, the - /etc/ttys file included entries for the first + A default FreeBSD install includes a + /etc/ttys file with support for the first four serial ports: ttyd0 through ttyd3. If you are attaching a terminal on one - of those ports, you do not need to add an entry. + of those ports, you do not need to add another entry. In our example, we attached a Wyse-50 to the second serial port, ttyd1, which is already in the file. We need @@ -527,9 +547,8 @@ ttyd5 the entries that start with the text std will work for hardwired terminals. These entries ignore parity. There is a std entry for each bps rate from 110 to 115200. - Of course, you can add your own entries to this file. The manual - page &man.gettytab.5; provides more - information. + Of course, you can add your own entries to this file. The + &man.gettytab.5; manual page provides more information. When setting the getty type in the /etc/ttys file, make sure that the @@ -585,8 +604,8 @@ ttyd5 "/usr/libexec/getty std.19200" vt100 Enabling the Port - The next field in /etc/ttys, the fourth - field, tells whether to enable the port. Putting + The fourth field in /etc/ttys + specifies if the port should be enabled. Putting on here will have the init process start the program in the second field, getty, which will prompt for a login. If you put @@ -608,38 +627,19 @@ ttyd5 "/usr/libexec/getty std.19200" vt100 on optional window specifier, but we will ignore that). The last field tells whether the port is secure. - What does secure mean? + Marking a port as secure means that you trust it enough + to allow the the root account (or any + account with a user ID of 0) to login from that port. + Insecure ports do not allow root + logins. On an insecure port, users must login from + unprivileged accounts and then use &man.su.1; or similar to + gain superuser privileges. - It means that the root account (or any account with a user ID of - 0) may login on the port. Insecure ports do not allow root to - login. + It is highly recommended that you use + insecure even for terminals that are behind + locked doors. It is quite easy to login and use &man.su.1; + if you need superuser privileges. - How do you use secure and insecure ports? - - By marking a port as insecure, the terminal to which it is - connected will not allow root to login. People who know the root - password to your FreeBSD system will first have to login using a - regular user account. To gain superuser privileges, they will then - have to use the su command. - - Because of this, you will have two records to help track down - possible compromises of root privileges: both the - login and the su command make - records in the system log (and logins are also recorded in the - wtmp file). - - By marking a port as secure, the terminal will allow root in. - People who know the root password will just login as root. You will - not have the potentially useful login and su - command records. - - Which should you use? - - Just use insecure. Use insecure - even for terminals not in - public user areas or behind locked doors. It is quite easy to login - and use su if you need superuser - privileges. Here finally are the completed entries in the /etc/ttys file, with comments added to describe @@ -653,26 +653,13 @@ ttyd5 "/usr/libexec/getty std.19200" vt100 on insecure # Guest bathroomForce init to Reread /etc/ttys - When you boot FreeBSD, the first process, - init, will read the - /etc/ttys file and start the programs listed - for each enabled port to prompt for logins. - - After you edit /etc/ttys, you do not want - to have to reboot your system to get init to see - the changes. So, init will reread - /etc/ttys if it receives a SIGHUP (hangup) - signal. - - So, after you have saved your changes to - /etc/ttys, send SIGHUP to - init by typing: + After making the necessary changes to the + /etc/ttys file you should send a SIGHUP + (hangup) signal to the init process to + force it to re-read its configuration file. For example : &prompt.root; kill -HUP 1 - (The init process always - has process ID 1.) - If everything is set up correctly, all cables are in place, and the terminals are powered up, you should see login prompts. Your terminals are ready for their first logins! @@ -707,24 +694,24 @@ ttyd5 "/usr/libexec/getty std.19200" vt100 on insecure # Guest bathroom Make sure that a getty process is running - and serving the terminal. Type + and serving the terminal. For example, to get a list of + running getty processes with ps, type: &prompt.root; ps -axww|grep getty - to get a - list of running getty processes. You should - see an entry for the terminal. For example, the display + You should see an entry for the terminal. For + example, the following display shows that a + getty is running on the second serial + port ttyd1 and is using the + std.38400 entry in + /etc/gettytab: 22189 d1 Is+ 0:00.03 /usr/libexec/getty std.38400 ttyd1 - - shows that a getty is running on the second - serial port ttyd1 and is using the - std.38400 entry in - /etc/gettytab. If no getty process is running, make sure you have enabled the port in /etc/ttys. - Make sure you have run kill -HUP 1. + Also remember to run kill -HUP 1 + after modifying the ttys file. @@ -755,42 +742,26 @@ ttyd5 "/usr/libexec/getty std.19200" vt100 on insecure # Guest bathroom + + + + Guy + Helmer + Contributed + + + Sean + Kelly + Additions + + + Dial-in Service dial-in service - Contributed by &a.ghelmer;. - This document provides suggestions for configuring a FreeBSD system - to handle dial-up modems. This document is written based on the author's - experience with FreeBSD versions 1.0, 1.1, and 1.1.5.1 (and experience - with dial-up modems on other Unix-like operating systems); however, this - document may not answer all of your questions or provide examples - specific enough to your environment. The author cannot be responsible if - you damage your system or lose data due to attempting to follow the - suggestions here. - - - Prerequisites - - To begin with, the author assumes you have some basic knowledge of - FreeBSD. You need to have FreeBSD installed, know how to edit files - in a Unix-like environment, and how to look up manual pages on the - system. As discussed below, you will need certain versions of - FreeBSD, and knowledge of some terminology & modem and - cabling. - - - FreeBSD Version - - First, it is assumed that you are using FreeBSD version 1.1 or - higher (including versions 2.X). FreeBSD version 1.0 included two - different serial drivers, which complicates the situation. Also, - the serial device driver (sio) has improved - in every release of FreeBSD, so more recent versions of FreeBSD are - assumed to have better and more efficient drivers than earlier - versions. - - + + Intro Terminology @@ -1185,12 +1156,10 @@ crw-rw---- 1 uucp dialer 28, 193 Feb 15 14:38 /dev/cuala1 /sbin/init what tty devices should have getty processes running on them. Lastly, you can place port initialization commands in the - /etc/rc.serial script if you have FreeBSD 1.1.5.1 - or higher; otherwise, you can initialize ports in the - /etc/rc.local script. + /etc/rc.serial script. There are two schools of thought regarding dial-up modems on Unix. - One group likes to configure their modems and system so that no matter + One group likes to configure their modems and systems so that no matter at what speed a remote user dials in, the local computer-to-modem RS-232 interface runs at a locked speed. The benefit of this configuration is that the remote user always sees a system login @@ -1209,7 +1178,7 @@ crw-rw---- 1 uucp dialer 28, 193 Feb 15 14:38 /dev/cuala1 login: message at an initial speed and watches the characters that come back in response. If the user sees junk, it is assumed that they know they should press the - <Enter> key until they see a recognizable + Enter key until they see a recognizable prompt. If the data rates do not match, getty sees anything the user types as junk, tries going to the next speed and gives the login: prompt again. This @@ -1250,11 +1219,9 @@ crw-rw---- 1 uucp dialer 28, 193 Feb 15 14:38 /dev/cuala1 /etc/gettytab to give getty information about the speeds you wish to use for your modem. If you have a 2400 bps modem, you can - probably use the existing D2400 entry. This - entry already exists in the FreeBSD 1.1.5.1 - gettytab file, so you do not need to add it - unless it is missing under your version of FreeBSD: - + probably use the existing D2400 + entry. + # # Fast dialup terminals, 2400/1200/300 rotary (can start either way) # @@ -1284,12 +1251,7 @@ up|V9600|High Speed Modem at 9600,8-bit:\ uq|V19200|High Speed Modem at 19200,8-bit:\ :nx=V9600:tc=std.19200: - On FreeBSD 1.1.5 and later, this will result in 8-bit, no - parity connections. Under FreeBSD 1.1, add - :np: parameters to the - std.xxx entries at - the top of the file for 8 bits, no parity; otherwise, the default - is 7 bits, even parity. + This will result in 8-bit, no parity connections. The example above starts the communications rate at 19.2 Kbps (for a V.32bis connection), then cycles through 9600 bps (for @@ -1328,24 +1290,16 @@ vq|VH57600|Very High Speed Modem at 57600,8-bit:\ <filename>/etc/ttys</filename> - - /etc/ttys - + + /etc/ttys + - /etc/ttys is the list of - ttys for init to monitor. - /etc/ttys also provides security information to - login (user root may only - login on ttys marked secure). See the manual - page for - &man.ttys.5; for more information. - - You will need to either modify existing lines in - /etc/ttys or add new lines to make - init run getty processes - automatically on your new dial-up ports. The general format of the - line will be the same, whether you are using a locked-speed or - matching-speed configuration: + Configuration of the /etc/ttys file + was covered in the last section for configuring terminals. + Configuration for modems is similar but we must pass a + different argument to getty and specify a + different terminal type. The general format for both + locked-speed and matching-speed configurations is: ttyd0 "/usr/libexec/getty xxx" dialup on @@ -1398,12 +1352,12 @@ vq|VH57600|Very High Speed Modem at 57600,8-bit:\ ttyd0 "/usr/libexec/getty std.19200" dialup on - If your modem is locked at a different data rate, substitute - the appropriate name for the - std.speed entry for - std.19200 from - /etc/gettytab for your modem's data - rate. + If your modem is locked at a different data rate, + substitute the appropriate value for + std.speed + instead of std.19200. Make sure that + you use a valid type listed in + /etc/gettytab. @@ -1423,53 +1377,28 @@ vq|VH57600|Very High Speed Modem at 57600,8-bit:\ - <filename>/etc/rc.serial</filename> or - <filename>/etc/rc.local</filename> - - rc files - rc.local - - - rc files - rc.serial - + <filename>/etc/rc.serial</filename> + + rc files + rc.serial + - High-speed modems, like V.32, V.32bis, and V.34 modems, need to - use hardware (RTS/CTS) flow control. You can - add stty commands to - /etc/rc.serial on FreeBSD 1.1.5.1 and up, or - /etc/rc.local on FreeBSD 1.1, to set the - hardware flow control flag in the FreeBSD kernel for the modem + High-speed modems, like V.32, V.32bis, and V.34 modems, + need to use hardware (RTS/CTS) flow + control. You can add stty commands to + /etc/rc.serial to set the hardware flow + control flag in the FreeBSD kernel for the modem ports. - For example, on a sample FreeBSD 1.1.5.1 system, - /etc/rc.serial reads: - - #!/bin/sh -# -# Serial port initial configuration - + For example to set the termios flag + crtscts on serial port #1's + (COM2:) dial-in and dial-out initialization + devices, the folling lines could be added to + /etc/rc.serial : + # Serial port initial configuration stty -f /dev/ttyid1 crtscts stty -f /dev/cuai01 crtscts - This sets the termios flag - crtscts on serial port #1's - (COM2:) dial-in and dial-out initialization - devices. - - On an old FreeBSD 1.1 system, these entries were added to - /etc/rc.local to set the - crtscts flag on the devices: - - # Set serial ports to use RTS/CTS flow control -stty -f /dev/ttyd0 crtscts -stty -f /dev/ttyd1 crtscts -stty -f /dev/ttyd2 crtscts -stty -f /dev/ttyd3 crtscts - - Since there is no initialization device special file on FreeBSD - 1.1, one has to just set the flags on the sole device special file - and hope the flags are not cleared by a miscreant. @@ -1490,7 +1419,7 @@ stty -f /dev/ttyd3 crtscts DTR asserted for operation; dropping DTR - hangs up line & resets modem + hangs up line and resets modem @@ -1570,9 +1499,9 @@ AT&C1&D2&H1&I0&R2&W Result codes should be disabled/suppressed for dial-up modems to avoid problems that can occur if getty mistakenly gives a login: prompt to a modem that is in command - mode and the modem echoes the command or returns a result code. I - have heard this sequence can result in a extended, silly conversation - between getty and the modem. + mode and the modem echoes the command or returns a result + code. This sequence can result in a extended, silly conversation + between getty and the modem. Locked-speed Config @@ -1675,7 +1604,7 @@ AT&B2&W Try dialing into the system; be sure to use 8 bits, no parity, 1 stop bit on the remote system. If you do not get a prompt right - away, or get garbage, try pressing <Enter> + away, or get garbage, try pressing Enter about once per second. If you still do not see a login: prompt after a while, try sending a BREAK. If you are using a high-speed modem to do @@ -1720,29 +1649,12 @@ AT&B2&W - - Acknowledgments - - Thanks to these people for comments and advice: - - - - &a.kelly; - - - for a number of good suggestions - - - - Dial-out Service dial-out service - Information integrated from FAQ. - The following are tips to getting your host to be able to connect over the modem to another computer. This is appropriate for establishing a terminal session with a remote host. @@ -1754,27 +1666,6 @@ AT&B2&W something and PPP is broken, use the terminal session to FTP it. Then use zmodem to transfer it to your machine. - - Why cannot I run <command>tip</command> or - <command>cu</command>? - - On your system, the programs tip and - cu are probably executable only by - uucp and group dialer. You - can use the group dialer to control who has - access to your modem or remote systems. Just add yourself to group - dialer. - - Alternatively, you can let everyone on your system run - tip and cu by typing: - - &prompt.root; chmod 4511 /usr/bin/tip - - You do not have to run this command for cu, - since cu is just a hard link to - tip. - - My stock Hayes modem is not supported, what can I do?