現在管理linux已經很少人用telnet,基本都用crt、xshell或者putty。因為後續需要講zabbix免用戶端監控只telnet,通過telnet來監控伺服器效能。
yum安裝telnet
yum安裝簡單快速
yum install telnet-server
配置telnet
telnet是放在xinetd裡,將disable改為yes,如下:
# vim /etc/xinetd.d/telnet
# default: on
# description: The telnet server serves telnet sessions; it uses \
# unencrypted username/password pairs for authentication.
service telnet
{
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/sbin/in.telnetd
log_on_failure += USERID
disable = no # 從yes改為no
}
如果需要使用root使用telnet登入,加上pts/0、pts1這樣的,否則跳過這一步
# cat /etc/securetty | grep pts
pts/0
pts/1
pts/2
pts/3
啟動telnet
# service xinetd start
Starting xinetd: [ OK ]
確認是否啟動
# netstat -lnt | grep :23
tcp 0 0 :::23 :::* LISTEN
建立普通使用者
如果已經有使用者了,那麼可以跳過這一步
# useradd ttlsa # 建立使用者
# passwd ttlsa # 修改密碼
Changing password for user ttlsa.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
telnet串連測試
使用root登入
CentOS release 6.5 (Final)
Kernel 3.15.4-x86_64-linode45 on an x86_64
login: root
Password:
Last login: Thu Feb 12 08:37:11 from 58.246.52.46
[root@li220-237 ~]#
普通使用者登入
CentOS release 6.5 (Final)
Kernel 3.15.4-x86_64-linode45 on an x86_64
login: ttlsa
Password:
$ w
08:41:05 up 199 days, 21:57, 2 users, load average: 0.00, 0.01, 0.05
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
ttlsa pts/1 51.241.12.49 08:40 1.00s 0.00s 0.00s w
root pts/0 51.241.12.49 08:27 1:37 0.01s 0.01s -bash
$