昨天机房里有一台CentOS5的服务器,大概是客户的误操作,无法SSH远程访问.接上显示器,通过终端进入到系统.
手工检查ssh发现没运行
[root@mgate ~]#/etc/init.d/sshd status
sshd is stopped
手工启动服务,报错.
[root@mgate ~]#/etc/init.d/sshd start
Starting sshd:/var/empty/sshd must be owned by root and not group or world-writable.
[FAILED]
上网查资料后,得知是报告权限错误,经查看发现这个目录的属主不是root,启动SSH报错
[root@mgate ~]# ls -ld /var/empty/sshd/
drwxr--r-- 3 vu0010root 4096 Nov 27 22:38 /var/empty/sshd/
[root@mgate ~]#
网络资料介绍了一种修改目录属性的方法,通过命令 chown root /var/empty/sshd/ 将其修改为root属主,并启动SSH,即可成功运行.执行命令后,系统没有任何响应,
[root@mgate ~]# chown root /var/empty/sshd/
[root@mgate ~]#
再启动SSH,依然报错
[root@mgate ~]#/etc/init.d/sshd start
Starting sshd:/var/empty/sshd must be owned by root and not group or world-writable.
[FAILED]
后来通过另一种方法修改权限后,
[root@mgate ~]#chown -R root /var/empty/sshd
[root@mgate ~]#chmod 744 /var/empty/sshd
虽然还是没任何提示,但这时启动SSH,可以成功运行了.
[root@mgate ~]#service sshd restart
Stop sshd: [ Fail ]
Starting sshd: [ OK ]
在Windows XP下运行软件SSH Secure Shell Client,可以正常登录该CentOS5服务器.问题总算解决了.其时已是三更.
在这期间,曾尝试着在系统上开通telnet远程服务,未果.今天上午在虚拟机上,用Red Hat5系统再调试telnet,终于成功了.以前都没接触过Linux下的telnet,这回的学习、调试的过程颇有收获
telnet服务,系统默认是安装了的,但不运行,需要手动配置telnet文件.在 /etc/xinetd.d/ 目录下查看到有三个telnet文件,分别是telnet,krb5-telnet,ekrb5-telnet(今早我Red Hat 5.4系统中,发现/etc/xinetd.d/只有krb5-telnet,ekrb5-telnet两个文件).但当时我没注意krb5-telnet这个文件.
其中telnet文件是空的,krb5-telnet,ekrb5-telnet两文件的service telnet脚本是一样的.如下:
service telnet
{
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/kerberos/sbin/telnet
log_on_failure = USERID
disable = yes
}
网上有资料说是将telnet文件的diable设置为no.鉴于该telnet文件为空,我直接在里面埴service telnet脚本.跟上面的基本一样,不同的是server的路径:
service telnet
{
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/sbin/in.telnetd
log_on_failure = USERID
disable = no
}
并通过service xinetd start 命令启动telnet,但telnet本机,并不能连通,显示配置无效.
[root@mgate ~]#telnet 127.0.0.1
Trying 127.0.0.1…
telnet: connect to address 127.0.0.1: Connection refused
telnet: Unable to connect to remote host: Connection refused
再将ekrb5-telnet的disable值赋为no,这时能telnet了,但无法通过加密认证,还是没法登录
[root@mgate ~]#service xinetd start
Starting xinetd:
[root@mgate ~]#telnet 127.0.0.1
Trying 127.0.0.1…
Connected to localhost.localdomain(127.0.0.1)
Escape character is ‘^]’.
Unencrypted connection r |