安装ssh
1.切换到root账户
lcl@lcl:~$ sudo passwd
[sudo] lcl 的密码:
输入新的 UNIX 密码:
重新输入新的 UNIX 密码:
passwd:已成功更新密码
lcl@lcl:~$ su
密码:
root@lcl:/home/lcl#
2.替换数据源,使能够更新软件
通过gedit打开文件->
root@lcl:/home/lcl# sudo gedit /etc/apt/sources.list
找一份正确的资源替换
3.更新系统现有的个种软件
root@lcl:/home/lcl# apt-get update
4.安装yum下载插件
root@lcl:/home/lcl# yum 程序“yum”尚未安装。 您可以使用以下命令安装: apt install yum root@lcl:/home/lcl# apt install yum 正在读取软件包列表... 完成 正在分析软件包的依赖关系树 正在读取状态信息... 完成 将会同时安装下列软件: debugedit librpm3 librpmbuild3 librpmio3 librpmsign1 libsqlite0 python-libxml2 python-pycurl python-rpm python-sqlite python-sqlitecachec python-urlgrabber rpm rpm-common rpm2cpio 建议安装: rpm-i18n libcurl4-gnutls-dev python-pycurl-dbg python-sqlite-dbg alien elfutils 下列【新】软件包将被安装: debugedit librpm3 librpmbuild3 librpmio3 librpmsign1 libsqlite0 python-libxml2 python-pycurl python-rpm python-sqlite python-sqlitecachec python-urlgrabber rpm rpm-common rpm2cpio yum 升级了 0 个软件包,新安装了 16 个软件包,要卸载 0 个软件包,有 31 个软件包未被升级。 需要下载 1,705 kB 的归档。 解压缩后会消耗 7,564 kB 的额外空间。 您希望继续执行吗? [Y/n] y<br>
5.下载防火墙管理
root@lcl:/home/lcl# apt-get install gufw
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
将会同时安装下列软件:
gir1.2-javascriptcoregtk-3.0 gir1.2-webkit-3.0 gnome-icon-theme
gnome-icon-theme-symbolic libicu52 libjavascriptcoregtk-3.0-0
libwebkitgtk-3.0-0 libwebkitgtk-3.0-common python-netifaces
下列【新】软件包将被安装:
gir1.2-javascriptcoregtk-3.0 gir1.2-webkit-3.0 gnome-icon-theme
gnome-icon-theme-symbolic gufw libicu52 libjavascriptcoregtk-3.0-0
libwebkitgtk-3.0-0 libwebkitgtk-3.0-common python-netifaces
升级了 0 个软件包,新安装了 10 个软件包,要卸载 0 个软件包,有 31 个软件包未被升级。
需要下载 17.3 MB 的归档。
解压缩后会消耗 72.2 MB 的额外空间。
您希望继续执行吗? [Y/n] y <br >
查看当前防火墙状态:
root@lcl:/home/lcl# ufw status <br >
状态:不活动<br >
6.下载ssh可能会显示如下错误
root@lcl:/home/lcl# apt-get install openssh-server
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
有一些软件包无法被安装。如果您用的是 unstable 发行版,这也许是
因为系统无法达到您要求的状态造成的。该版本中可能会有一些您需要的软件
包尚未被创建或是它们已被从新到(Incoming)目录移出。
下列信息可能会对解决问题有所帮助:
下列软件包有未满足的依赖关系:
openssh-server : 依赖: openssh-client (= 1:6.6p1-2ubuntu2.8)
依赖: openssh-sftp-server 但是它将不会被安装
推荐: ssh-import-id 但是它将不会被安装
E: 无法修正错误,因为您要求某些软件包保持现状,就是它们破坏了软件包间的依赖关系。<br >
显示这个是是因为系统的openssh-client的版本过高,需要降级:
root@lcl:/home/lcl# apt-get install openssh-client=1:6.6p1-2ubuntu2.8
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
正在读取状态信息... 完成
建议安装:
ssh-askpass libpam-ssh keychain monkeysphere
下列软件包将被【降级】:
openssh-client
升级了 0 个软件包,新安装了 0 个软件包,降级了 1 个软件包,要卸载 0 个软件包,有 31 个软件包未被升级。
需要下载 564 kB 的归档。
解压缩后将会空出 260 kB 的空间。
您希望继续执行吗? [Y/n] y
获取:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu trusty-updates/main amd64 openssh-client amd64 1:6.6p1-2ubuntu2.8 [564 kB]
已下载 564 kB,耗时 1秒 (405 kB/s)
dpkg:警告:即将把 openssh-client 从 1:7.2p2-4 降级到 1:6.6p1-2ubuntu2.8
(正在读取数据库 ... 系统当前共安装有 176733 个文件和目录。)
正准备解包 .../openssh-client_1%3a6.6p1-2ubuntu2.8_amd64.deb ...
正在将 openssh-client (1:6.6p1-2ubuntu2.8) 解包到 (1:7.2p2-4) 上 ...
正在处理用于 man-db (2.7.5-1) 的触发器 ...
正在设置 openssh-client (1:6.6p1-2ubuntu2.8) ...
正在安装新版本配置文件 /etc/ssh/moduli ...
正在安装新版本配置文件 /etc/ssh/ssh_config ...
重新更新软件:
root@lcl:/home/lcl# apt-get update
忽略:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu trusty InRelease
命中:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu trusty-updates InRelease
命中:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu trusty-backports InRelease
命中:4 https://mirrors.tuna.tsinghua.edu.cn/ubuntu trusty-security InRelease
命中:5 https://mirrors.tuna.tsinghua.edu.cn/ubuntu trusty Release
正在读取软件包列表... 完成
重新下载ssh:
root@lcl:/home/lcl# apt-get install openssh-server 正在读取软件包列表... 完成 正在分析软件包的依赖关系树 正在读取状态信息... 完成 将会同时安装下列软件: libck-connector0 ncurses-term openssh-sftp-server 建议安装: ssh-askpass rssh molly-guard monkeysphere 推荐安装: ssh-import-id 下列【新】软件包将被安装: libck-connector0 ncurses-term openssh-server openssh-sftp-server 升级了 0 个软件包,新安装了 4 个软件包,要卸载 0 个软件包,有 31 个软件包未被升级。 需要下载 609 kB 的归档。 解压缩后会消耗 3,339 kB 的额外空间。 您希望继续执行吗? [Y/n] y 获取:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu trusty/main amd64 libck-connector0 amd64 0.4.5-3.1ubuntu2 [10.5 kB] 获取:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu trusty/main amd64 ncurses-term all 5.9+20140118-1ubuntu1 [243 kB] 获取:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu trusty-updates/main amd64 openssh-sftp-server amd64 1:6.6p1-2ubuntu2.8 [34.2 kB] 获取:4 https://mirrors.tuna.tsinghua.edu.cn/ubuntu trusty-updates/main amd64 openssh-server amd64 1:6.6p1-2ubuntu2.8 [322 kB] 已下载 609 kB,耗时 1秒 (431 kB/s) 正在预设定软件包 ... 正在选中未选择的软件包 libck-connector0:amd64。 (正在读取数据库 ... 系统当前共安装有 176733 个文件和目录。) 正准备解包 .../libck-connector0_0.4.5-3.1ubuntu2_amd64.deb ... 正在解包 libck-connector0:amd64 (0.4.5-3.1ubuntu2) ... 正在选中未选择的软件包 ncurses-term。 正准备解包 .../ncurses-term_5.9+20140118-1ubuntu1_all.deb ... 正在解包 ncurses-term (5.9+20140118-1ubuntu1) ... 正在选中未选择的软件包 openssh-sftp-server。 正准备解包 .../openssh-sftp-server_1%3a6.6p1-2ubuntu2.8_amd64.deb ... 正在解包 openssh-sftp-server (1:6.6p1-2ubuntu2.8) ... 正在选中未选择的软件包 openssh-server。 正准备解包 .../openssh-server_1%3a6.6p1-2ubuntu2.8_amd64.deb ... 正在解包 openssh-server (1:6.6p1-2ubuntu2.8) ... 正在处理用于 man-db (2.7.5-1) 的触发器 ... 正在处理用于 ufw (0.35-0ubuntu2) 的触发器 ... 正在处理用于 ureadahead (0.100.0-19) 的触发器 ... 正在处理用于 systemd (229-4ubuntu4) 的触发器 ... 正在设置 libck-connector0:amd64 (0.4.5-3.1ubuntu2) ... 正在设置 ncurses-term (5.9+20140118-1ubuntu1) ... 正在设置 openssh-sftp-server (1:6.6p1-2ubuntu2.8) ... 正在设置 openssh-server (1:6.6p1-2ubuntu2.8) ... Creating SSH2 RSA key; this may take some time ... Creating SSH2 DSA key; this may take some time ... Creating SSH2 ECDSA key; this may take some time ... Creating SSH2 ED25519 key; this may take some time ... 正在处理用于 libc-bin (2.23-0ubuntu3) 的触发器 ... 正在处理用于 ufw (0.35-0ubuntu2) 的触发器 ... 正在处理用于 ureadahead (0.100.0-19) 的触发器 ... 正在处理用于 systemd (229-4ubuntu4) 的触发器 ...
查看开启ssh:
root@lcl:/home/lcl# ps -ef | grep sshd root 5828 2356 0 15:48 pts/1 00:00:00 grep --color=auto sshd root@lcl:/home/lcl# ufw allow 22 防火墙规则已更新 规则已更新(v6) root@lcl:/home/lcl# sudo /etc/init.d/ssh start [ ok ] Starting ssh (via systemctl): ssh.service.