telnet

2021-04-23, updated 2021-09-12

Telnet协议是TCP/IP协议族中的一员,是Internet远程登录服务的标准协议和主要方式。

服务端程序telnetd

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
~ # telnetd -h
telnetd: invalid option -- 'h'
BusyBox v1.23.1 (2021-04-16 11:26:22 CST) multi-call binary.

Usage: telnetd [OPTIONS]

Handle incoming telnet connections

        -l LOGIN        Exec LOGIN on connect
        -f ISSUE_FILE   Display ISSUE_FILE instead of /etc/issue
        -K              Close connection as soon as login exits
                        (normally wait until all programs close slave pty)
        -p PORT         Port to listen on
        -b ADDR[:PORT]  Address to bind to
        -F              Run in foreground
        -i              Inetd mode
        -w SEC          Inetd 'wait' mode, linger time SEC
        -S              Log to syslog (implied by -i or without -F and -w)

客户端程序telnet

1
2
3
4
5
6
7
8
9
~ # telnet
BusyBox v1.23.1 (2021-04-16 11:26:22 CST) multi-call binary.

Usage: telnet [-a] [-l USER] HOST [PORT]

Connect to telnet server

        -a      Automatic login with $USER variable
        -l USER Automatic login as USER

问题:解决root用户无法使用telnet命令登录服务器

telnet 密码修改命令:passwd

使用tty命令查询用户登录方式,

1
2
#tty
/dev/pts/3

并将登录方式添加到/etc/securetty文件中

解决办法:

在/etc/sucuretty内容中添加如下内容

1
2
3
4
5
6
pts/0
pts/1
pts/2
pts/3
pts/4
pts/5
words: 352 tags: telnet