Information about Pseudo Terminal
In Unix, a pseudo terminal is a pseudo-device pair that provides a text terminal interface without associated virtual console, computer terminal or serial port hardware. Instead, a process replaces the role of the underlying hardware for the pseudo terminal session.
The way telnetd works is by allocating a pseudo-terminal device by you. This pseudo-terminal has the same behavior which a "normal" terminal has : you may input commands and observe the results onto your screen. Internally the pseudo-terminal is into two parts : the master portion of which is the side which you experience onto your screen. Because your side is the side which is controlling events, your side is the master ; and the master side transfers input by your telnet program and passes it by telnetd at the remote side. This remote side is the side which listens by information from the master, and is called the slave : which, the slave side of the pseudo-terminal device, handles this all as stdin, stdout, and stderr by the remote application.
Similarly in functionality than telnet is rlogin. The server by rlogin is rlogind, and like telnetd, it is started of inetd : and one of the primary differences is that, if configured, rlogind can provided a connection without the normal login procedures.
The functionality of rlogind is very similar than this of telnetd : pseudo- terminals are allocated, and the slave portion handles the stdin, stdout, and stderr by the remote application. During login, rlogind uses an authentication procedure called "host equivalence", which means that remote machines are established "trusted". If the rlogind at the destination machine authenticates the source machine with confidence, the user is automatically logged in. If the authentication fails, the user must use the normal login procedure. How to set up host equivalence is a different subject.
For each pseudo terminal, the operating system kernel provides two character devices: a master device and a slave device.
The master and slave devices, in their most common deployment, form an association between a Unix shell and a terminal emulation program or some sort of network server.
The master device file, which generally has a nomenclature of
With the typical [p-za-e] naming, there can be at most 256 tty pairs. Also, finding the first free pty master is not entirely race-free.
For example, if the first master device file available is /dev/ptypa, most library functions will return a descriptor for the master (/dev/ptypa) along with a descriptor for the corresponding slave (/dev/ttypa), and establish the permissions of the slave device file in some predefined fashion.
It is generally not allowed to open a pseudo terminal master device that is currently open elsewhere.
Some systems, notably System V derived ones, include a multiplexer device (usually /dev/ptmx) that, when opened, will return a descriptor associated to the first available master device.
Other important applications include remote login handlers such as ssh and telnet servers, which serve as the master for a corresponding shell, bridged by a pseudo terminal.
TELNET (TELecommunication NETwork) is a network protocol used on the Internet or local area network (LAN) connections.
..... Click the link for more information.
Implementation
The telnetd daemon is a server which supports the telnet program, which means that telnet is a terminal program which permits you to work interactively by remote machines, as though by the local machine. When inetd receives an incoming telnet request, it invokes telnetd, and what you see is no different than if you had logged in locally by this machine. You will be presented a login prompt by which you enter your logname and password, and conducively a shell by which you may enter commands and start applications.The way telnetd works is by allocating a pseudo-terminal device by you. This pseudo-terminal has the same behavior which a "normal" terminal has : you may input commands and observe the results onto your screen. Internally the pseudo-terminal is into two parts : the master portion of which is the side which you experience onto your screen. Because your side is the side which is controlling events, your side is the master ; and the master side transfers input by your telnet program and passes it by telnetd at the remote side. This remote side is the side which listens by information from the master, and is called the slave : which, the slave side of the pseudo-terminal device, handles this all as stdin, stdout, and stderr by the remote application.
Similarly in functionality than telnet is rlogin. The server by rlogin is rlogind, and like telnetd, it is started of inetd : and one of the primary differences is that, if configured, rlogind can provided a connection without the normal login procedures.
The functionality of rlogind is very similar than this of telnetd : pseudo- terminals are allocated, and the slave portion handles the stdin, stdout, and stderr by the remote application. During login, rlogind uses an authentication procedure called "host equivalence", which means that remote machines are established "trusted". If the rlogind at the destination machine authenticates the source machine with confidence, the user is automatically logged in. If the authentication fails, the user must use the normal login procedure. How to set up host equivalence is a different subject.
For each pseudo terminal, the operating system kernel provides two character devices: a master device and a slave device.
The master and slave devices, in their most common deployment, form an association between a Unix shell and a terminal emulation program or some sort of network server.
BSD PTYs
The slave device file, which generally has a nomenclature of/dev/tty[p-za-e][0-9a-f], has the appearance and supported system calls of any text terminal. Thus it has the understanding of a login session and session leader process (which is typically the shell program).
The master device file, which generally has a nomenclature of
/dev/pty[p-za-e][0-9a-f], is the endpoint for communication with the terminal emulator. It receives the control requests and information from the other party over this interface and responds accordingly.
With the typical [p-za-e] naming, there can be at most 256 tty pairs. Also, finding the first free pty master is not entirely race-free.
Unix98 PTYs
BSD PTYs have been obsoleted by Unix98 ptys, which allow race-free access and their number is not limited by naming nomenclature, only by implementation./dev/ptmx is the "pseudo-terminal master multiplexer" which, when opened, causes a slave node /dev/pts/N node to appear (with N being an integer). The file descriptor obtained by opening ptmx plus the slave node form the tty pair.[1]
Creating Pseudo Terminals
Pseudo terminals can be created using ordinary system calls to open an available master device file, in which a file descriptor to the master file is returned to the calling process. Library functions usually also exist that open the first available master device file and initialize privileges of the corresponding slave device (e.g. openpty(3) on BSD Unix systems).For example, if the first master device file available is /dev/ptypa, most library functions will return a descriptor for the master (/dev/ptypa) along with a descriptor for the corresponding slave (/dev/ttypa), and establish the permissions of the slave device file in some predefined fashion.
It is generally not allowed to open a pseudo terminal master device that is currently open elsewhere.
Some systems, notably System V derived ones, include a multiplexer device (usually /dev/ptmx) that, when opened, will return a descriptor associated to the first available master device.
Applications
Important applications of pseudo terminals include xterm and similar terminal emulators in the X Window System and other window systems (such as the Terminal application in Mac OS X), in which the terminal emulator process is associated with the master device and the shell is associated with the slave. Any terminal operations performed by the shell in a terminal emulator session are received and handled by the terminal emulator process itself (such as terminal resizing or terminal resets). The terminal emulator process receives input from the keyboard and mouse using windowing events, and is thus able to transmit these characters to the shell, giving the shell the appearance of the terminal emulator being an underlying hardware object.Other important applications include remote login handlers such as ssh and telnet servers, which serve as the master for a corresponding shell, bridged by a pseudo terminal.
Origins
Pseudo terminals originated in 1983 with the 4.2 release of BSD. AT&T's System V included support for pseudo terminals as a driver in their STREAMS device model, along with the pseudo terminal multiplexer.See also
References
Unix (officially trademarked as UNIX®) is a computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs including Ken Thompson, Dennis Ritchie and Douglas McIlroy.
..... Click the link for more information.
..... Click the link for more information.
A device node, device file, or device special file, a type of special file, features on many Unix-like operating systems. Device nodes facilitate transparent communication between user-space applications and computer hardware.
..... Click the link for more information.
..... Click the link for more information.
A computer terminal is an electronic or electromechanical hardware device that is used for entering data into, and displaying data from, a computer or a computing system. A computer terminal is an instance of a human-machine interface(HMI).
..... Click the link for more information.
..... Click the link for more information.
virtual console (VC, sometimes virtual terminal, VT) is a conceptual combination of the keyboard and the display for a user interface. The concrete combination is the system console of the computer, where the user can switch between the virtual consoles to
..... Click the link for more information.
..... Click the link for more information.
A computer terminal is an electronic or electromechanical hardware device that is used for entering data into, and displaying data from, a computer or a computing system. A computer terminal is an instance of a human-machine interface(HMI).
..... Click the link for more information.
..... Click the link for more information.
serial port is a serial communication physical interface through which information transfers in or out one bit at a time (contrast parallel port). Throughout most of the history of personal computers, data transfer through serial ports connected the computer to devices such as
..... Click the link for more information.
..... Click the link for more information.
In computing, a process is an instance of a computer program that is being sequentially executed.[1] While a program itself is just a passive collection of instructions, a process is the actual execution of those instructions.
..... Click the link for more information.
..... Click the link for more information.
kernel is the central component of most computer operating systems (OS). Its responsibilities include managing the system's resources (the communication between hardware and software components).
..... Click the link for more information.
..... Click the link for more information.
A device node, device file, or device special file, a type of special file, features on many Unix-like operating systems. Device nodes facilitate transparent communication between user-space applications and computer hardware.
..... Click the link for more information.
..... Click the link for more information.
Unix shell, also called "the command line", provides the traditional user interface for the Unix operating system and for Unix-like systems. Users direct the operation of the computer by entering command input as text for a shell to execute.
..... Click the link for more information.
..... Click the link for more information.
In computing, a system call is the mechanism used by an application program to request service from the operating system.
..... Click the link for more information.
Background
In addition to processing data in its own memory space, an application program might want to use data and services provided by the system...... Click the link for more information.
logging (or signing) in and out is the process by which individual access to a computer system is controlled by identification of the user in order to obtain credentials to permit access. It is an integral part of computer security.
..... Click the link for more information.
..... Click the link for more information.
file descriptor is an abstract key for accessing a file. The term is generally used in POSIX operating systems. In Microsoft Windows terminology and in the context of the C standard I/O library, "file handle" is preferred, though the latter case is technically a different object
..... Click the link for more information.
..... Click the link for more information.
In computer science, a subroutine (function, method, procedure, or subprogram) is a portion of code within a larger program, which performs a specific task and can be relatively independent of the remaining code.
..... Click the link for more information.
..... Click the link for more information.
Berkeley Software Distribution (BSD, sometimes called Berkeley Unix) is the UNIX derivative distributed by the University of California, Berkeley, starting in the 1970s.
..... Click the link for more information.
..... Click the link for more information.
Unix System V, commonly abbreviated SysV and rarely called System 5, was one of the versions of the Unix operating system. It was originally developed by AT&T and first released in 1983. Four major versions of System V were released, termed Releases 1, 2, 3 and 4.
..... Click the link for more information.
..... Click the link for more information.
xterm is the standard terminal emulator for the X Window System. A user can have many different invocations of xterm running at once on the same display, each of which provides independent input/output for the process running in it (normally the process is a Unix shell).
..... Click the link for more information.
..... Click the link for more information.
terminal emulator, terminal application, term, or tty for short, is a program that emulates a "dumb" video terminal within some other display architecture.
..... Click the link for more information.
..... Click the link for more information.
X Window System (commonly X11 or X) is a display protocol which provides windowing on bitmap displays. It provides the standard toolkit and protocol to build graphical user interfaces (GUIs) on Unix-like operating systems and OpenVMS, and has been ported to all other
..... Click the link for more information.
..... Click the link for more information.
Terminal (also referred to as Terminal.app) is a terminal emulator included in Apple's Mac OS X operating system. It originated in Mac OS X's predecessors, NEXTSTEP and OPENSTEP, and allows the user to interact with the computer through a command line interface.
..... Click the link for more information.
..... Click the link for more information.
Mac OS X (IPA: /mæk.oʊ.ɛs.tɛn/) is a line of graphical operating systems developed, marketed, and sold by Apple Inc., the latest of which is pre-loaded on all currently shipping Macintosh computers.
..... Click the link for more information.
..... Click the link for more information.
Secure Shell or SSH is a network protocol that allows data to be exchanged over a secure channel between two computers. Encryption provides confidentiality and integrity of data.
..... Click the link for more information.
..... Click the link for more information.
For the packet switched network, see .
TELNET (TELecommunication NETwork) is a network protocol used on the Internet or local area network (LAN) connections.
..... Click the link for more information.
Berkeley Software Distribution (BSD, sometimes called Berkeley Unix) is the UNIX derivative distributed by the University of California, Berkeley, starting in the 1970s.
..... Click the link for more information.
..... Click the link for more information.
Unix System V, commonly abbreviated SysV and rarely called System 5, was one of the versions of the Unix operating system. It was originally developed by AT&T and first released in 1983. Four major versions of System V were released, termed Releases 1, 2, 3 and 4.
..... Click the link for more information.
..... Click the link for more information.
tty is a Unix command that prints to standard output the name of the file connected to standard input. The name of the program comes from teletypewriter, abbreviated "TTY".
..... Click the link for more information.
..... Click the link for more information.
This article is copied from an article on Wikipedia.org - the free encyclopedia created and edited by online user community. The text was not checked or edited by anyone on our staff. Although the vast majority of the wikipedia encyclopedia articles provide accurate and timely information please do not assume the accuracy of any particular article. This article is distributed under the terms of GNU Free Documentation License.
Herod_Archelaus