NAME
getty - set terminal type, modes, speed, and line discipline
SYNOPSIS
/sbin/getty [-hN] [-t timeout] line [speed [type [linedisc]]]
/sbin/getty -c file
DESCRIPTION
getty is a program that is invoked by init(1M). It is the second process
in the series, (init-getty-login-shell) that ultimately connects a user
with the UNIX system. It can only be executed by the super-user; that
is, a process with the user-ID of root. Initially getty prints the
contents of /etc/issue (if it exists), then prints the login message
field for the entry it is using from /etc/gettydefs, reads the user's
login name, and invokes the login(1) command with the user's name as
argument. While reading the name, getty attempts to adapt the system to
the speed and type of terminal being used. It does this by using the
options and arguments specified.
Line is the name of a tty line in /dev to which getty is to attach
itself. getty uses this string as the name of a file in the /dev
directory to open for reading and writing. Unless getty is invoked with
the -h flag, getty will force a hangup on the line by setting the speed
to zero before setting the speed to the default or specified speed. The
-t flag plus timeout (in seconds), specifies that getty should exit if
the open on the line succeeds and no one types anything in the specified
number of seconds.
The -N option honors the /etc/nologin file. When present, getty does not
answer the line, but instead waits for the file to go away.
Speed, the optional second argument, is a label to a speed and tty
definition in the file /etc/gettydefs. This definition tells getty at
what speed to initially run, what the login message should look like,
what the initial tty settings are, and what speed to try next should the
user indicate that the speed is inappropriate (by typing a <break>
character).
Type, the optional third argument, is a character string describing to
getty what type of terminal is connected to the line in question. getty
recognizes the following types:
none default
ds40-1 Dataspeed40/1
tektronix,tek Tektronix
vt61 DEC vt61
vt100 DEC vt100
hp45 Hewlett-Packard 45
c100 Concept 100
Page 1
GETTY(1M) GETTY(1M)
The default terminal is none; i.e., any crt or normal terminal unknown to
the system. Also, for terminal type to have any meaning, the virtual
terminal handlers must be compiled into the operating system. They are
available, but not compiled in the default condition.
Linedisc, the optional fourth argument, is a character string describing
which line discipline to use in communicating with the terminal. There
are two line disciplines. LDISC0 is the familiar System V line
discipline. LDISC1 is similar to the 4.3BSD ``new tty driver'' (see
termio(7)). LDISC1 is the default.
When given no optional arguments, getty sets the speed of the interface
to 9600 baud, specifies that raw mode is to be used (awaken on every
character), that echo is to be suppressed, either parity allowed, new-
line characters will be converted to carriage return-line feed, and tab
expansion performed on the standard output. It types the login message
before reading the user's name a character at a time. If a null
character (or framing error) is received, it is assumed to be the result
of the user pushing the ``break'' key. This will cause getty to attempt
the next speed in the series. The series that getty tries is determined
by what it finds in /etc/gettydefs. Modems which "lock" to a single
speed, such as most high speed modems, should be used with a gettydefs
entry which sticks to a single speed, such as dx_19200. This also
applies to devices that send spurious ``break'' signals. To allow baud
rate cycling on the main serial console, change the ttyd1 entry from
console to co_9600.
After the user's name has been typed in, it is terminated by a new-line
or carriage-return character. The latter results in the system being set
to treat carriage returns appropriately (see ioctl(2)).
The user's name is scanned to see if it contains any lower-case
alphabetic characters; if not, and if the name is non-empty, the system
is told to map any future upper-case characters into the corresponding
lower-case characters.
Finally, login is exec(2)'d with the user's name as an argument.
Additional arguments may be typed after the login name. These are passed
to login, which will place them in the environment (see login(1)).
If getty is running on the graphics console, getty checks to see if
autologin is enabled by verifying the existence of /etc/autologin and
/etc/autologin.on (see login(1)). If autologin is enabled, getty will
invoke login with the autologin option.
getty cannot be used on a line that is also to be used by outgoing calls
made by uucp, cu, or similar programs. The very similar uugetty(1M) use
should be used instead.
When getty is invoked with the -c option and file, it scans the file as
if it were scanning /etc/gettydefs during normal operation, and prints
out the results to the standard output. If there are any unrecognized
Page 2
GETTY(1M) GETTY(1M)
modes or improperly constructed entries, it reports these. If the
entries are correct, it prints out the values of the various flags. See
ioctl(2) to interpret the values. Note that some values are added to the
flags automatically.
FILES
/etc/nologin
/etc/gettydefs
/etc/issue message printed before login prompt
/etc/autologin
/etc/autologin.on
/var/adm/SYSLOG
SEE ALSO
init(1M), login(1), uugetty(1M), cu(1C), uucp(1C), ioctl(2),
gettydefs(4), inittab(4), tty(7), serial(7)
DIAGNOSTICS
Most error messages are sent to the system log, /var/adm/SYSLOG. A
message similar to
getty[5310]: ioctl(TCSETAF)584: Invalid argument
may indicate that the tty line does not support the baud rate specified
in /etc/gettydefs. See serial(7) for information on which baud rates are
supported.
BUGS
While getty understands simple single character quoting conventions, it
is not possible to quote certain special control characters used by
getty. Thus, you cannot login via getty and type a #, @, /, !, _<i>_,
backspace, ^U, ^D, or & as part of your login name or arguments. getty
uses them to determine when the end of the line has been reached, which
protocol is being used, and what the erase character is. They will
always be interpreted as having their special meaning.
-----Original Message-----
From: redhat-devel-list-admin@xxxxxxxxxx [mailto:redhat-devel-list-admin@xxxxxxxxxx] On Behalf Of mara ailiez sy
Sent: Wednesday, January 28, 2004 10:11 AM
To: redhat-devel-list@xxxxxxxxxx
Subject: Re: Re: About remote loginanother question: what is getty prog?You can do that easily in C... there is "getpass" routine for get your input without echoing ....use gethostbyname , connect , send , recv etc to connect to the remote host ......getty prog is useful here ...As far as I remember "rlogin" source was included in one book by W RICHARD STEVENS( unix n/w programming ???? ) .......If you look at the RFC 1282 , it will give info about how to format the messages between theclient/server .......telnet's implementation is different from rlogin's-Nipun-----Original Message-----
From: redhat-devel-list-admin@xxxxxxxxxx [mailto:redhat-devel-list-admin@xxxxxxxxxx]On Behalf Of mara ailiez sy
Sent: Wednesday, January 28, 2004 7:17 PM
To: redhat-devel-list@xxxxxxxxxx
Subject: about remote loginHello... I am currently researching about remote login and came across Python's Telnetlib. However, I cannot find a similar library in C. Does anyone know if there is an equivalent library in C or the equivalent functions can be implemented in C.Attached here is the sample code in Python that I want to implement in C:import getpass
import sys
import telnetlib
HOST = "localhost"
user = raw_input("Enter your remote account: ")
password = getpass.getpass()
tn = telnetlib.Telnet(HOST)
tn.read_until("login: ")
tn.write(user + "\n")
if password:
tn.read_until("Password: ")
tn.write(password + "\n")
tn.write("ls\n")
tn.write("exit\n")thanks very much
print tn.read_all()
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!