Chinaunix首页 | 论坛 | 博客
  • 博客访问: 467416
  • 博文数量: 98
  • 博客积分: 3265
  • 博客等级: 中校
  • 技术积分: 1227
  • 用 户 组: 普通用户
  • 注册时间: 2010-10-23 00:29
文章分类

全部博文(98)

文章存档

2012年(6)

2011年(83)

2010年(9)

分类: LINUX

2011-06-10 10:16:46

使用的是red hat enterprise 5 系统
现想用Source CRT远程登录red hat系统,实现Windows主机上远程操作Linux主机的目的
Source CRT为Windows上使用的串口/远程登录的客户端
使用Source CRT远程登录Linux主机有Telnet和SSH两种服务,区别在于SSH带有数据加密功能
那么Linux主机上要装有SSH服务端,并且开启了服务
1,查看是否装有SSH服务端:
[root@localhost ~]# sshd -v
sshd: illegal option -- v
OpenSSH_4.3p2, OpenSSL 0.9.8b 04 May 2006
这里表面已经装有了SSH服务端,否则的话先下载SSH服务端安装

2,查看服务是否开启:
[root@localhost ssh]# service sshd restart
停止 sshd:                                                [失败]
启动 sshd:@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0777 for '/etc/ssh/ssh_host_rsa_key' are too open.
It is recommended that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: /etc/ssh/ssh_host_rsa_key
Could not load host key: /etc/ssh/ssh_host_rsa_key
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0777 for '/etc/ssh/ssh_host_dsa_key' are too open.
It is recommended that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: /etc/ssh/ssh_host_dsa_key
Could not load host key: /etc/ssh/ssh_host_dsa_key
Disabling protocol version 2. Could not load host key
sshd: no hostkeys available -- exiting.
大体上看出是密匙之类的问题,没有这个密匙,进入/etc/ssh,里面有ssh_host_dsa_key,ssh_host_rsa_key,难道是权限问题?

好吧再次生成密匙看看:
[root@localhost ~]# ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
Generating public/private dsa key pair.
/etc/ssh/ssh_host_dsa_key already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /etc/ssh/ssh_host_dsa_key.
Your public key has been saved in /etc/ssh/ssh_host_dsa_key.pub.
The key fingerprint is:
4c:63:cb:78:d9:29:fd:30:c5:c6:37:1f:81:48:93:77 root@localhost.localdomain
[root@localhost ~]# ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
Generating public/private rsa key pair.
/etc/ssh/ssh_host_rsa_key already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /etc/ssh/ssh_host_rsa_key.
Your public key has been saved in /etc/ssh/ssh_host_rsa_key.pub.
The key fingerprint is:
5a:19:3a:84:95:39:d3:91:07:68:46:90:93:85:ad:d8 root@localhost.localdomain
再次:
[root@localhost ssh]# service sshd restart
还是不行,看来是权限问题了,事实上,Ssh服务的所在文件权限太大,也不能启动该服务
解决办法如下 
[root@localhost /]# cd /etc/ssh
[root@localhost ssh]# ls -l
总计 204
-rwxrwxrwx 1 root root 132839 2007-07-13 moduli
-rwxrwxrwx 1 root root   1827 2007-07-13 ssh_config
-rwxrwxrwx 1 root root   3301 2007-07-13 sshd_config
-rwxrwxrwx 1 root root    668 06-10 09:10 ssh_host_dsa_key
-rwxrwxrwx 1 root root    612 06-10 09:10 ssh_host_dsa_key.pub
-rwxrwxrwx 1 root root    963 2010-10-12 ssh_host_key
-rwxrwxrwx 1 root root    627 2010-10-12 ssh_host_key.pub
-rwxrwxrwx 1 root root   1675 06-10 09:11 ssh_host_rsa_key
-rwxrwxrwx 1 root root    408 06-10 09:11 ssh_host_rsa_key.pub
果然权限全是777,太大了,改权限吧:
[root@localhost ssh]# chmod 600 sshd_config ssh_host_dsa_key
[root@localhost ssh]# chmod 600 ssh_host_key ssh_host_rsa_key
[root@localhost ssh]# chmod 620 moduli
[root@localhost ssh]# chmod 644 ssh_config ssh_host_dsa_key.pub
[root@localhost ssh]# chmod 644 ssh_host_rsa_key
修改权限后如下:
总计 204
-rw--w---- 1 root root 132839 2007-07-13 moduli
-rw-r--r-- 1 root root   1827 2007-07-13 ssh_config
-rw------- 1 root root   3301 2007-07-13 sshd_config
-rw------- 1 root root    668 06-10 09:10 ssh_host_dsa_key
-rw-r--r-- 1 root root    612 06-10 09:10 ssh_host_dsa_key.pub
-rw------- 1 root root    963 2010-10-12 ssh_host_key
-rwxrwxrwx 1 root root    627 2010-10-12 ssh_host_key.pub
-rw-r--r-- 1 root root   1675 06-10 09:11 ssh_host_rsa_key
-rwxrwxrwx 1 root root    408 06-10 09:11 ssh_host_rsa_key.pub
重新开启ssh服务,可以了:
[root@localhost ssh]# /etc/rc.d/init.d/sshd start
[root@localhost ssh]# service sshd restart
这两个命令是等同的,使用其一即可

永久开启相关服务:可在终端下输入:setup
查看Linux主机IP:ifconfig
修改Linux主机IP:ifconfig eth0 ***.***.***.***
开网关:ifconfig eth0 up
关网关:ifconfig eth0 down

Windows上运行Source CRT,配置如下:
说明主机名为Linux主机的IP,要求与Windows主机在同一个IP段内即可
阅读(3916) | 评论(0) | 转发(0) |
0

上一篇:sequence point

下一篇:各个启动程序

给主人留下些什么吧!~~