安装openssh-server报Depends: openssh-client ,= 1:6.6p1-2ubuntu2.8错误

SFTP称作“安全的FTP”,它使用ssh文件传输协议。所以我们需要安装openssh-server

ubuntu自带的有openssh-client,所以可以通过

sshusername@host

来远程连接linux。

可是要想通过ssh被连接,ubuntu系统需要有openssh-server,可以通过如下操作:

1、可是要想通过ssh被连接,ubuntu系统需要有openssh-server,可以通过

ps -e|grep ssh 来查看,

显示如下:

7153 ? 00:00:00 sshd

7222 ? 00:00:00 sshd

7262 ? 00:00:00 sshd

如果没有显示sshd则说明没有安装openssh-server。

2、可通过

sudo apt-get install openssh-server

安装openssh-server,如果顺利的话会安装成功,如果遇到以下问题:

openssh-server : Depends: openssh-client (= 1:6.6p1-2ubuntu2.8)

Recommends: ssh-import-id but it is not going to be installed

E: Unable to correct problems, you have held broken packages.

原因如下:

这是因为,openssh-server是依赖于openssh-clien的,那ubuntu不是自带了openssh-client吗?

原由是自带的openssh-clien与所要安装的openssh-server所依赖的版本不同,这里所依赖的版本是:

1:6.6p1-2ubuntu2.8

所以要安装对应版本的openssh-clien,来覆盖掉ubuntu自带的

sudoapt-getinstallopenssh-client=1:6.6p1-2ubuntu1

这样再安装openssh-server就可以成功了。

二、怎么查看Ubuntu的ssh端口:

在 etc/ssh 下面有个 ssh_config的文件
使用vim或者vi打开
里面有个port 这里就是ssh对外开放的端口
如果前面有#代表这个使用的是默认端口
如果不想使用默认端口把井号去掉Port xxxx顶头写就行了
注意:Port一定要顶头,不能有空格