Ubuntu
下安装 OpenSSH Server 是无比轻松的一件事情,需要的命令只有一条:
sudo apt-get install openssh-server
通过以下命令启动ssh服务
sudo service ssh start
sudo /etc/init.d/ssh start
(查看返回的结果,如果没有出错,则用putty、SecureCRT、SSH Secure Shell Client等SSH 客户端软件,输入您服务器的 IP 地址。如果一切正常的话,等一会儿就可以连接上了。并且使用现有的用户名和密码应该就可以登录了。)
然后确认sshserver是否启动了:(或用“netstat -tlp”命令)
ps -e | grep ssh
如果只有ssh-agent那ssh-server还没有启动,需要/etc/init.d/ssh start,如果看到sshd那说明ssh-server已经启动了。
但在执行sudo apt-get install openssh-server出现Package has no installation candidate,解决方法如下:
# apt-get install
Reading package lists... Done
Building dependency tree... Done
Package aptitude is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package has no installation candidate
解决方法如下:
# sudo apt-get update //可能提示失败,执行第二步
# sudo apt-get upgrade //可能提示失败,执行第三步吧
# sudo apt-get install //再执行就成功了,这里执行apt-get install ssh
如果还不行请换163的源,参考http://mirrors.163.com/.help/ubuntu.html
使用说明
以Wily(15.10)为例, 编辑/etc/apt/sources.list文件, 在文件最前面添加以下条目(操作前请做好相应备份)
deb http://mirrors.163.com/ubuntu/ wily main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ wily-security main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ wily-updates main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ wily-proposed main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ wily-backports main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ wily main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ wily-security main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ wily-updates main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ wily-proposed main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ wily-backports main restricted universe multiverse