ubuntu16安装openssh-server报Depends: openssh-client (= 1:7.2p2-4ubuntu2.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。

二、安装ssh

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

openssh-server : Depends: openssh-client (= 1:7.2p2-4ubuntu2.1)
Depends: openssh-sftp-server but it is not going to be installed
Recommends: ncurses-term but it is not installable
Recommends: ssh-import-id but it is not installable
E: Unable to correct problems, you have held broken packages.

原因如下:

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

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

1:7.2p2-4ubuntu2.1

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

sudo apt-get install openssh-client=1:7.2p2-4ubuntu2.1

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

三、安装好后查看SSH是否启动

打开”终端窗口”,输入”sudo ps -e |grep ssh“–>回车–>有sshd,说明ssh服务已经启动,如果没有启动,输入”sudo service ssh start“–>回车–>ssh服务就会启动

四、使用vi修改配置文件”/etc/ssh/sshd_config” 获取远程ROOT权限

打开”终端窗口”,输入”sudo vi /etc/ssh/sshd_config“–>回车–>把配置文件中的”PermitRootLogin without-password“加一个”#”号,把它注释掉–>再增加一句”PermitRootLogin yes“–>保存,修改成功


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM