现在管理linux基本都用crt、xshell或者putty,已经没什么人用telnet,因为后续需要讲zabbix免客户端监控只telnet,通过telnet来监控服务器性能。
yum安装telnet
yum安装简单快速
1
|
yum install telnet-server
|
配置telnet
telnet是放在xinetd里,将disable改为yes,如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
# 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这样的,否则跳过这一步
1
2
3
4
5
|
# cat /etc/securetty | grep pts
pts/0
pts/1
pts/2
pts/3
|
启动telnet
1
2
|
# service xinetd start
Starting xinetd: [ OK ]
|
确认是否启动
1
2
|
# netstat -lnt | grep :23
tcp 0 0 :::23 :::* LISTEN
|
创建普通用户
如果已经有用户了,那么可以跳过这一步
1
2
3
4
5
6
|
# useradd ttlsa # 创建用户
# passwd ttlsa # 修改密码
Changing password for user ttlsa.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
|
还需要安装telnet客户端
yum install -y telnet
telnet 不运行root用户登录
telnet连接测试
使用root登录
1
2
3
4
5
6
|
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 ~]#
|
普通用户登录
1
2
3
4
5
6
7
8
9
10
|
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
$
|