putty远程登录linux有啥用,[笔记] putty远程登录Linux

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

今于windows下用putty远程登录linux,报错为“Connection refused”(连接被拒绝)。查阅资料得到两处:

http://www.linuxidc.com/Linux/2007-12/9551.htm

http://wiki.ubuntu.org.cn/UbuntuHelp:SSHHowto

究其原因是没有安装openSSH,由于我用的是Ubuntu,所以执行如下命令:

$ sudo apt-get install openssh-server

执行后需下载285kB的软件包,解压消耗782kB额外空间。其获取信息为:

1 http://archive.ubuntu.com jaunty/main openssh-server 1:5.lpl-5ubuntu1 [285kB]

安装之后再使用putty登录,成功。

另复制一段参考链接1的处理:

//----------------------------------------------------------------------------------------------------------------------

可以在windows平台下使用putty连接远程Linux主机。

如果putty提示“Connection refused”,那么可能是远程主机没有安装OpenSSH。可以通过命令

# rpm -qa openssh

# rpm -qa openssh-server

查看是否安装OpenSSH。如果没有,需自行安装。一般系统安装盘中都有OpenSSH的安装软件包。

如果已经安装了OpenSSH,那么可能的原因就是没有启动SSH了。这时候的情况一般如下:

# /usr/sbin/sshd

系统提示"

Could not load host key: /etc/ssh/ssh_host_key

Could not load host key: /etc/ssh/ssh_host_rsa_key

Could not load host key: /etc/ssh/ssh_host_dsa_key

Disabling protocol version 1. Could not load host key

Disabling protocol version 2. Could not load host key

sshd: no hostkeys available — exiting”

大致的意思就是需要某个key什么的。

解决办法如下:

#ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key

Generating public/private dsa key pair.

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:

xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx root@localhost.localdomain

#ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key

Generating public/private rkey pair.

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_dsa_rey.pub.

root@localhost.localdomain

#/usr/sbin/sshd

这时候,就可以在windows底下使用putty连接这台linux主机了。

//----------------------------------------------------------------------------------------------------------------------

另外关于putty登录linux时的乱码问题,是由于字符编码不统一。一般linux的编码可能是UTF-8,可以使用env命令查看。而putty默认使用的操作系统的编码方式(简体中文GB2312)。所以要统一编码方式。可以修改putty的来匹配linux,右击putty标题栏,选择change settings...,将Window的Translation中的Received data assumed to be in which character set 改为 UTF-8即可。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值