⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 telnetd.8

📁 linux下telnet服务端的源码实现
💻 8
字号:
.\" Copyright (c) 1983, 1993.\"	The Regents of the University of California.  All rights reserved..\".\" Redistribution and use in source and binary forms, with or without.\" modification, are permitted provided that the following conditions.\" are met:.\" 1. Redistributions of source code must retain the above copyright.\"    notice, this list of conditions and the following disclaimer..\" 2. Redistributions in binary form must reproduce the above copyright.\"    notice, this list of conditions and the following disclaimer in the.\"    documentation and/or other materials provided with the distribution..\" 4. Neither the name of the University nor the names of its contributors.\"    may be used to endorse or promote products derived from this software.\"    without specific prior written permission..\".\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION).\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF.\" SUCH DAMAGE..\".\"	@(#)telnetd.8	8.4 (Berkeley) 6/1/94.\".Dd June 1, 1994.Dt TELNETD 8.Os BSD 4.2.Sh NAME.Nm telnetd.Nd DARPA.Tn TELNETprotocol server.Sh SYNOPSIS.Nm /usr/libexec/telnetd.Op Fl BUhlkns.Op Fl D Ar debugmode.Op Fl I Ns Ar initid.Op Fl S Ar tos.Op Fl X Ar authtype.Op Fl a Ar authmode.Op Fl edebug.Op Fl r Ns Ar lowpty-highpty.Op Fl u Ar len.Op Fl debug Op Ar port.Sh DESCRIPTIONThe.Nm telnetdcommand is a server which supports the.Tn DARPAstandard.Tn TELNETvirtual terminal protocol..Nm Telnetdis normally invoked by the internet server (see.Xr inetd 8 )for requests to connect to the.Tn TELNETport as indicated by the.Pa /etc/servicesfile (see.Xr services 5 ) .The.Fl debugoption may be used to start up.Nm telnetdmanually, instead of through.Xr inetd 8 .If started up this way,.Ar portmay be specified to run.Nm telnetdon an alternate.Tn TCPport number..PpThe.Nm telnetdcommand accepts the following options:.Bl -tag -width "-a authmode".It Fl a Ar authmodeThis option may be used for specifying what mode shouldbe used for authentication.Note that this option is only useful if.Nm telnetdhas been compiled with support for the.Dv AUTHENTICATIONoption.There are several valid values for.Ar authmode:.Bl -tag -width debug.It debugTurns on authentication debugging code..It userOnly allow connections when the remote usercan provide valid authentication informationto identify the remote user,and is allowed access to the specified accountwithout providing a password..It validOnly allow connections when the remote usercan provide valid authentication informationto identify the remote user.The.Xr login 1command will provide any additional user verificationneeded if the remote user is not allowed automaticaccess to the specified account..It otherOnly allow connections that supply some authentication information.This option is currently not supportedby any of the existing authentication mechanisms,and is thus the same as specifying.Fl a.Cm valid ..It noneThis is the default state.Authentication information is not required.If no or insufficient authentication informationis provided, then the.Xr login 1program will provide the necessary userverification..It offThis disables the authentication code.All user verification will happen through the.Xr login 1program..El.It Fl BSpecifies bftp server mode.  In this mode,.Nm telnetdcauses login to start a.Xr bftp 1session rather than the user'snormal shell.  In bftp daemon mode normallogins are not supported, and it must be usedon a port other than the normal.Tn TELNETport..It Fl D Ar debugmodeThis option may be used for debugging purposes.This allows.Nm telnetdto print out debugging informationto the connection, allowing the user to see what.Nm telnetdis doing.There are several possible values for.Ar debugmode:.Bl -tag -width exercise.It Cm optionsPrints information about the negotiation of.Tn TELNEToptions..It Cm reportPrints the.Cm optionsinformation, plus some additional informationabout what processing is going on..It Cm netdataDisplays the data stream received by.Nm telnetd..It Cm ptydataDisplays data written to the pty..It Cm exerciseHas not been implemented yet..El.It Fl debugEnables debugging on each socket created by.Nm telnetd(see.Dv SO_DEBUGin.Xr socket 2 ) ..It Fl edebugIf.Nm telnetdhas been compiled with support for data encryption, then the.Fl edebugoption may be used to enable encryption debugging code..It Fl hDisables the printing of host-specific information beforelogin has been completed..It Fl I Ar initidThis option is only applicable to.Tn UNICOSsystems prior to 7.0.It specifies the.Dv IDfrom.Pa /etc/inittabto use when init starts login sessions.  The default.Dv IDis.Dv fe..It Fl kThis option is only useful if.Nm telnetdhas been compiled with both linemode and kludge linemodesupport.  If the.Fl koption is specified, then if the remote client does notsupport the.Dv LINEMODEoption, then.Nm telnetdwill operate in character at a time mode.It will still support kludge linemode, but will onlygo into kludge linemode if the remote client requestsit.(This is done by by the client sending.Dv DONT SUPPRESS-GO-AHEADand.Dv DONT ECHO . )The.Fl koption is most useful when there are remote clientsthat do not support kludge linemode, but pass the heuristic(if they respond with.Dv WILL TIMING-MARKin response to a.Dv DO TIMING-MARK)for kludge linemode support..It Fl lSpecifies line mode.  Tries to force clients to use line-at-a-time mode.If the.Dv LINEMODEoption is not supported, it will gointo kludge linemode..It Fl nDisable.Dv TCPkeep-alives.  Normally.Nm telnetdenables the.Tn TCPkeep-alive mechanism to probe connections thathave been idle for some period of time to determineif the client is still there, so that idle connectionsfrom machines that have crashed or can no longerbe reached may be cleaned up..It Fl r Ar lowpty-highptyThis option is only enabled when.Nm telnetdis compiled for.Dv UNICOS.It specifies an inclusive range of pseudo-terminal devices touse.  If the system has sysconf variable.Dv _SC_CRAY_NPTYconfigured, the default pty search range is 0 to.Dv _SC_CRAY_NPTY;otherwise, the default range is 0 to 128.  Either.Ar lowptyor.Ar highptymay be omitted to allow changingeither end of the search range.  If.Ar lowptyis omitted, the - character is still required so that.Nm telnetdcan differentiate.Ar highptyfrom.Ar lowpty ..It Fl sThis option is only enabled if.Nm telnetdis compiled with support for.Tn SecurIDcards.It causes the.Fl soption to be passed on to.Xr login 1 ,and thus is only useful if.Xr login 1supports the.Fl sflag to indicate that only.Tn SecurIDvalidated logins are allowed, and isusually useful for controlling remote loginsfrom outside of a firewall..It Fl S Ar tos.It Fl u Ar lenThis option is used to specify the size of the fieldin the.Dv utmpstructure that holds the remote host name.If the resolved host name is longer than.Ar len ,the dotted decimal value will be used instead.This allows hosts with very long host names thatoverflow this field to still be uniquely identified.Specifying.Fl u0indicates that only dotted decimal addressesshould be put into the.Pa utmpfile..ne 1i.It Fl UThis option causes.Nm telnetdto refuse connections from addresses thatcannot be mapped back into a symbolic namevia the.Xr gethostbyaddr 3routine..It Fl X Ar authtypeThis option is only valid if.Nm telnetdhas been built with support for the authentication option.It disables the use of.Ar authtypeauthentication, andcan be used to temporarily disablea specific authentication type without having to recompile.Nm telnetd ..El.Pp.Nm Telnetdoperates by allocating a pseudo-terminal device (see.Xr pty 4 )for a client, then creating a login process which hasthe slave side of the pseudo-terminal as.Dv stdin ,.Dv stdoutand.Dv stderr ..Nm Telnetdmanipulates the master side of the pseudo-terminal,implementing the.Tn TELNETprotocol and passing charactersbetween the remote client and the login process..PpWhen a.Tn TELNETsession is started up,.Nm telnetdsends.Tn TELNEToptions to the client side indicatinga willingness to do thefollowing.Tn TELNEToptions, which are described in more detail below:.Bd -literal -offset indentDO AUTHENTICATIONWILL ENCRYPTDO TERMINAL TYPEDO TSPEEDDO XDISPLOCDO NEW-ENVIRONDO ENVIRONWILL SUPPRESS GO AHEADDO ECHODO LINEMODEDO NAWSWILL STATUSDO LFLOWDO TIMING-MARK.Ed.PpThe pseudo-terminal allocated to the client is configuredto operate in \*(lqcooked\*(rq mode, and with.Dv XTABS and.Dv CRMODenabled (see.Xr tty 4 ) ..Pp.Nm Telnetdhas support for enabling locally the following.Tn TELNEToptions:.Bl -tag -width "DO AUTHENTICATION".It "WILL ECHO"When the.Dv LINEMODEoption is enabled, a.Dv WILL ECHOor.Dv WONT ECHOwill be sent to the client to indicate thecurrent state of terminal echoing.When terminal echo is not desired, a.Dv WILL ECHOis sent to indicate that.Tn telnetdwill take care of echoing any data that needs to beechoed to the terminal, and then nothing is echoed.When terminal echo is desired, a.Dv WONT ECHOis sent to indicate that.Tn telnetdwill not be doing any terminal echoing, so theclient should do any terminal echoing that is needed..It "WILL BINARY"Indicates that the client is willing to send a8 bits of data, rather than the normal 7 bitsof the Network Virtual Terminal..It "WILL SGA"Indicates that it will not be sending.Dv IAC GA,go ahead, commands..It "WILL STATUS"Indicates a willingness to send the client, uponrequest, of the current status of all.Tn TELNEToptions..It "WILL TIMING-MARK"Whenever a.Dv DO TIMING-MARKcommand is received, it is always respondedto with a.Dv WILL TIMING-MARK.ne 1i.It "WILL LOGOUT"When a.Dv DO LOGOUTis received, a.Dv WILL LOGOUTis sent in response, and the.Tn TELNETsession is shut down..It "WILL ENCRYPT"Only sent if.Nm telnetdis compiled with support for data encryption, andindicates a willingness to decryptthe data stream..El.Pp.Nm Telnetdhas support for enabling remotely the following.Tn TELNEToptions:.Bl -tag -width "DO AUTHENTICATION".It "DO BINARY"Sent to indicate that.Tn telnetdis willing to receive an 8 bit data stream..It "DO LFLOW"Requests that the client handle flow controlcharacters remotely..It "DO ECHO"This is not really supported, but is sent to identify a 4.2BSD.Xr telnet 1client, which will improperly respond with.Dv WILL ECHO.If a.Dv WILL ECHOis received, a.Dv DONT ECHOwill be sent in response..It "DO TERMINAL-TYPE"Indicates a desire to be able to request thename of the type of terminal that is attachedto the client side of the connection..It "DO SGA"Indicates that it does not need to receive.Dv IAC GA,the go ahead command..It "DO NAWS"Requests that the client inform the server whenthe window (display) size changes..It "DO TERMINAL-SPEED"Indicates a desire to be able to request informationabout the speed of the serial line to whichthe client is attached..It "DO XDISPLOC"Indicates a desire to be able to request the nameof the X windows display that is associated withthe telnet client..It "DO NEW-ENVIRON"Indicates a desire to be able to request environmentvariable information, as described in RFC 1572..It "DO ENVIRON"Indicates a desire to be able to request environmentvariable information, as described in RFC 1408..It "DO LINEMODE"Only sent if.Nm telnetdis compiled with support for linemode, andrequests that the client do line by line processing..It "DO TIMING-MARK"Only sent if.Nm telnetdis compiled with support for both linemode andkludge linemode, and the client responded with.Dv WONT LINEMODE.If the client responds with.Dv WILL TM,the it is assumed that the client supportskludge linemode.Note that the.Op Fl koption can be used to disable this..It "DO AUTHENTICATION"Only sent if.Nm telnetdis compiled with support for authentication, andindicates a willingness to receive authenticationinformation for automatic login..It "DO ENCRYPT"Only sent if.Nm telnetdis compiled with support for data encryption, andindicates a willingness to decryptthe data stream..Sh ENVIRONMENT.Sh FILES.Pa /etc/services.br.Pa /etc/inittab(UNICOS systems only).br.Pa /etc/iptos(if supported).br.Pa /usr/ucb/bftp(if supported).Sh "SEE ALSO".Xr telnet 1 ,.Xr login 1 ,.Xr bftp 1(if supported).Sh STANDARDS.Bl -tag -compact -width RFC-1572.It Cm RFC-854.Tn TELNETPROTOCOL SPECIFICATION.It Cm RFC-855TELNET OPTION SPECIFICATIONS.It Cm RFC-856TELNET BINARY TRANSMISSION.It Cm RFC-857TELNET ECHO OPTION.It Cm RFC-858TELNET SUPPRESS GO AHEAD OPTION.It Cm RFC-859TELNET STATUS OPTION.It Cm RFC-860TELNET TIMING MARK OPTION.It Cm RFC-861TELNET EXTENDED OPTIONS - LIST OPTION.It Cm RFC-885TELNET END OF RECORD OPTION.It Cm RFC-1073Telnet Window Size Option.It Cm RFC-1079Telnet Terminal Speed Option.It Cm RFC-1091Telnet Terminal-Type Option.It Cm RFC-1096Telnet X Display Location Option.It Cm RFC-1123Requirements for Internet Hosts -- Application and Support.It Cm RFC-1184Telnet Linemode Option.It Cm RFC-1372Telnet Remote Flow Control Option.It Cm RFC-1416Telnet Authentication Option.It Cm RFC-1411Telnet Authentication: Kerberos Version 4.It Cm RFC-1412Telnet Authentication: SPX.It Cm RFC-1571Telnet Environment Option Interoperability Issues.It Cm RFC-1572Telnet Environment Option.Sh BUGSSome.Tn TELNETcommands are only partially implemented..PpBecause of bugs in the original 4.2 BSD.Xr telnet 1 ,.Nm telnetdperforms some dubious protocol exchanges to try to discover if the remoteclient is, in fact, a 4.2 BSD.Xr telnet 1 ..PpBinary modehas no common interpretation except between similar operating systems(Unix in this case)..PpThe terminal type name received from the remote client is converted tolower case..Pp.Nm Telnetdnever sends.Tn TELNET.Dv IAC GA(go ahead) commands.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -