怎样在centos下开启telnet办事
怎样在centos下开启telnet效劳?
1.查看linux版本信息:
[loong@localhost ~]$ cat /etc/issue CentOS release 5.8 (Final)Kernel \r on an \m
2. 查看系统可否已安置telnet-server,linux系统上默许已经安置telnet-client(或telnet),而telnet-server需要手动安置。
[loong@localhost ~]$ rpm -qa | grep telnet telnet-0.17-39.el5
3. 安置telnet-server,若系统已安置,跳过此步。
办法一:下载RPM resource telnet-server
选中响应版本的telnet-server下载;
安置:# rpm -i telnet-server-0.17-39.el5.i386.rpm
#貌似还得独自安置xinetd.
办法二:(引荐使用)
# yum install telnet-server
安置完成后:
[loong@localhost ~]$ rpm -qa | grep telnet telnet-0.17-39.el5 telnet-server-0.17-39.el5
4. 启动telnet效劳
办法一:System->Administration->Services 中,
在On Demand Services
中选中telnet
,
并在Background Services中选中xinetd,并点击上面的Start,即在右侧显示:xinetd (pid 15986) is running...
最后Save & Quit.
办法二:编纂/etc/xinetd.d/telnet
, 将其中的 disable = yes
的yes
改为no
.
修改后:
# default: on# description: The telnet server serves telnet sessions; it uses \ # unencrypted username/password pairs for authentication.service telnet
{
disable = no
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/sbin/in.telnetd
log_on_failure += USERID
}
办法三:使用chkconfig命令直接开启
[root@localhost loong]# chkconfig telnet on
注:办法二和办法三,需要激活xinetd效劳。办法如下:
[root@localhost loong]# service xinetd restart Stopping xinetd: [ OK ] Starting xinetd: [ OK ]
或:
[root@localhost loong]# /etc/rc.d/init.d/xinetd restart Stopping xinetd: [ OK ] Starting xinetd: [ OK ]
5. 测试效劳
[root@localhost loong]# telnet localhost Trying 127.0.0.1...Connected to localhost.localdomain (127.0.0.1).Escape character is '^]'.CentOS release 5.8 (Final)Kernel 2.6.18-308.1.1.el5 on an i686 login: loong Password: Last login: Tue Apr 24 16:42:06 from 10.108.14.135[loong@localhost ~]$ exitlogout Connection closed by foreign host.[root@localhost loong]#
注:默许状况下,系统只同意一般会员telnet登录,不同意root会员登录。
要想获得root权限,可以使用一般会员登录,然后施行su,来获得root权限。
或使用一下办法,同意root登录telnet:
办法一:# mv /etc/securetty /etc/securetty.bak (不倡议这种办法,测试完后再改回去吧!)
或先试图使用root会员登录,不成功,然后查看系统log:
telnet> o localhost Trying 127.0.0.1...Connected to localhost.localdomain (127.0.0.1).Escape character is '^]'.CentOS release 5.8 (Final)Kernel 2.6.18-308.1.1.el5 on an i686 login: root Password: Login incorrect login: Login incorrect login: Login incorrect login: Connection closed by foreign host.[root@localhost loong]# tail -20 /var/log/secure Apr 24 17:32:58 localhost login: pam_securetty(remote:auth): access denied: tty 'pts/1' is not secure ! Apr 24 17:33:03 localhost login: FAILED LOGIN 1 FROM localhost FOR root, Authentication failure
可以看到 access denied: tty 'pts/1' is not secure ! 所以将‘pts/1’增加到/etc/securetty中,即可实现telnet的root会员登录。至于为什么?暂不分明。 办法二:修改/etc/pam.d/remote,注释掉:auth required pam_securetty.so 1 #%PAM-1.02 #auth required pam_securetty.so3 auth include system-auth
注:不倡议开放telnet的root登录,容易带来平安隐患。
相关参照 :centOS教程
以上就是怎样在centos下开启telnet效劳的具体内容,更多请关注百分百源码网其它相关文章!