标签:
在 VMWare 中安装了 Ubuntu 16.04,想要 Win10 中通过 SecureCRT 来操作。
在网上查找了说是 Ubuntu 默认未安装 ssh-server,只有 ssh-client,所以在 Ubunta 中安装 ssh-server 就成了首要的任务。
Ubunta 中可以上网,但使用如下命令:
sudo apt-get install openssh-server
总是失败。
1 先是提示:
Reading package lists... Done Building dependency tree Reading state information... Done Package openssh-server 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 openssh-server has no installation candidate
通过查找关键字:“Package openssh-server has no installation candidate”,得到的结论是需要在 /etc/apt/source.list 中添加最新的源。
操作如下:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup (备份下当前的源列表) sudo gedit /etc/apt/sources.list 必须使用 sudo,否则编辑后无法保存 sudo apt-get update
以下为我增加的新源列表:
deb http://debian.ustc.edu.cn/ubuntu/ hardy main multiverse restricted universe deb http://debian.ustc.edu.cn/ubuntu/ hardy-backports main multiverse restricted universe deb http://debian.ustc.edu.cn/ubuntu/ hardy-proposed main multiverse restricted universe deb http://debian.ustc.edu.cn/ubuntu/ hardy-security main multiverse restricted universe deb http://debian.ustc.edu.cn/ubuntu/ hardy-updates main multiverse restricted universe deb-src http://debian.ustc.edu.cn/ubuntu/ hardy main multiverse restricted universe deb-src http://debian.ustc.edu.cn/ubuntu/ hardy-backports main multiverse restricted universe deb-src http://debian.ustc.edu.cn/ubuntu/ hardy-proposed main multiverse restricted universe deb-src http://debian.ustc.edu.cn/ubuntu/ hardy-security main multiverse restricted universe deb-src http://debian.ustc.edu.cn/ubuntu/ hardy-updates main multiverse restricted universe deb http://mirror.bjtu.edu.cn/Ubuntu/ hardy main restricted universe multiverse deb http://mirror.bjtu.edu.cn/Ubuntu/ hardy-backports restricted universe multiverse deb http://mirror.bjtu.edu.cn/Ubuntu/ hardy-proposed main restricted universe multiverse deb http://mirror.bjtu.edu.cn/Ubuntu/ hardy-security main restricted universe multiverse deb http://mirror.bjtu.edu.cn/Ubuntu/ hardy-updates main restricted universe multiverse deb-src http://mirror.bjtu.edu.cn/Ubuntu/ hardy main restricted universe multiverse deb-src http://mirror.bjtu.edu.cn/Ubuntu/ hardy-backports main restricted universe multiverse deb-src http://mirror.bjtu.edu.cn/Ubuntu/ hardy-proposed main restricted universe multiverse deb-src http://mirror.bjtu.edu.cn/Ubuntu/ hardy-security main restricted universe multiverse deb-src http://mirror.bjtu.edu.cn/Ubuntu/ hardy-updates main restricted universe multiverse deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy main restricted universe multiverse deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy main restricted universe multiverse deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-updates main restricted universe multiverse deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-updates main restricted universe multiverse deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-backports main restricted universe multiverse deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-backports main restricted universe multiverse deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-security main restricted universe multiverse deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-security main restricted universe multiverse deb http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-proposed main multiverse restricted universe deb-src http://ubuntu.csie.ntu.edu.tw/ubuntu/ hardy-proposed main restricted universe multiverse deb http://Ubuntu.cn99.com/ubuntu/ hardy main restricted universe multiverse deb http://Ubuntu.cn99.com/ubuntu/ hardy-security main restricted universe multiverse deb http://Ubuntu.cn99.com/ubuntu/ hardy-updates main restricted universe multiverse deb http://Ubuntu.cn99.com/ubuntu/ hardy-proposed main restricted universe multiverse deb http://Ubuntu.cn99.com/ubuntu/ hardy-backports main restricted universe multiverse deb-src http://Ubuntu.cn99.com/ubuntu/ hardy main restricted universe multiverse deb-src http://Ubuntu.cn99.com/ubuntu/ hardy-security main restricted universe multiverse deb-src http://Ubuntu.cn99.com/ubuntu/ hardy-updates main restricted universe multiverse deb-src http://Ubuntu.cn99.com/ubuntu/ hardy-proposed main restricted universe multiverse deb-src http://Ubuntu.cn99.com/ubuntu/ hardy-backports main restricted universe multiverse deb http://mirror.lupaworld.com/ubuntu hardy main restricted universe multiverse deb http://mirror.lupaworld.com/ubuntu hardy-security main restricted universe multiverse deb http://mirror.lupaworld.com/ubuntu hardy-updates main restricted universe multiverse deb http://mirror.lupaworld.com/ubuntu hardy-backports main restricted universe multiverse deb http://mirror.lupaworld.com/ubuntu hardy-proposed main restricted universe multiverse deb-src http://mirror.lupaworld.com/ubuntu hardy main restricted universe multiverse deb-src http://mirror.lupaworld.com/ubuntu hardy-security main restricted universe multiverse deb-src http://mirror.lupaworld.com/ubuntu hardy-updates main restricted universe multiverse deb-src http://mirror.lupaworld.com/ubuntu hardy-backports main restricted universe multiverse deb-src http://mirror.lupaworld.com/ubuntu hardy-proposed main restricted universe multiverse 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
2 再执行后,又出现如下的提示:
Reading package lists... Done Building dependency tree Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: openssh-server : Depends: openssh-client (= 1:7.1p2-2) but 1:7.2p2-4 is to be installed Depends: openssh-sftp-server but it is not going to be installed Recommends: ncurses-term but it is not going to be installed Recommends: ssh-import-id but it is not going to be installed E: Unable to correct problems, you have held broken packages.
(1) 执行 sudo apt-get install openssh-client 得到如下提示:
Reading package lists... Done Building dependency tree Reading state information... Done openssh-client is already the newest version (1:7.2p2-4). openssh-client set to manually installed. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
说明 ssh-client 的版本是 1:7.2p2-4。但 ssh-server 需要的版本是 1:7.1p2-2,所以重新安装 ssh-client:
执行如下命令:
sudo apt-get install openssh-client=1:7.1p2-2
(2) 最后执行
sudo apt-get install openssh-server
安装成功,有如下提示:
Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: ncurses-term openssh-sftp-server ssh-import-id Suggested packages: ssh-askpass rssh molly-guard monkeysphere The following NEW packages will be installed: ncurses-term openssh-server openssh-sftp-server ssh-import-id 0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded. Need to get 680 kB of archives. After this operation, 5,303 kB of additional disk space will be used. Do you want to continue? [Y/n] Get:1 http://ubuntu.uhost.hk xenial/main i386 ncurses-term all 6.0+20151024-2ubuntu2 [249 kB] Get:2 http://ubuntu.uhost.hk xenial/main i386 openssh-sftp-server i386 1:7.1p2-2 [43.5 kB] Get:3 http://ubuntu.uhost.hk xenial/main i386 openssh-server i386 1:7.1p2-2 [377 kB] Get:4 http://ubuntu.uhost.hk xenial/main i386 ssh-import-id all 5.4-0ubuntu1 [10.2 kB] Fetched 680 kB in 1s (393 kB/s) Preconfiguring packages ... Selecting previously unselected package ncurses-term. (Reading database ... 175352 files and directories currently installed.) Preparing to unpack .../ncurses-term_6.0+20151024-2ubuntu2_all.deb ... Unpacking ncurses-term (6.0+20151024-2ubuntu2) ... Selecting previously unselected package openssh-sftp-server. Preparing to unpack .../openssh-sftp-server_1%3a7.1p2-2_i386.deb ... Unpacking openssh-sftp-server (1:7.1p2-2) ... Selecting previously unselected package openssh-server. Preparing to unpack .../openssh-server_1%3a7.1p2-2_i386.deb ... Unpacking openssh-server (1:7.1p2-2) ... Selecting previously unselected package ssh-import-id. Preparing to unpack .../ssh-import-id_5.4-0ubuntu1_all.deb ... Unpacking ssh-import-id (5.4-0ubuntu1) ... Processing triggers for man-db (2.7.5-1) ... Processing triggers for ufw (0.35-0ubuntu2) ... Processing triggers for ureadahead (0.100.0-19) ... Processing triggers for systemd (229-4ubuntu4) ... Setting up ncurses-term (6.0+20151024-2ubuntu2) ... Setting up openssh-sftp-server (1:7.1p2-2) ... Setting up openssh-server (1:7.1p2-2) ... Creating SSH2 RSA key; this may take some time ... 2048 SHA256:eTIAvnJujqvm9G5b4AGAOJAT3TjUZb9TeoLlHHBLIPo root@ubuntu (RSA) Creating SSH2 DSA key; this may take some time ... 1024 SHA256:uMR18rv+/XzpblKeuUo8uCfcTirxYdZRI5iJCKMepdM root@ubuntu (DSA) Creating SSH2 ECDSA key; this may take some time ... 256 SHA256:OMOdYN/vXgShnwv6O7fO9IWFeyFK5sUzZGei99iiIPk root@ubuntu (ECDSA) Creating SSH2 ED25519 key; this may take some time ... 256 SHA256:0U4aFCAo3apBtzQRpTTGzJJ9Yk0hYlqiJEVJR9uA/dU root@ubuntu (ED25519) Setting up ssh-import-id (5.4-0ubuntu1) ... Processing triggers for ureadahead (0.100.0-19) ... Processing triggers for systemd (229-4ubuntu4) ... Processing triggers for ufw (0.35-0ubuntu2) ...
3 执行 ps -e | grep ssh 得到如下提示:
4860 ? 00:00:00 sshd
看到 sshd 说明 ssh-server 已经启动了
4 通过 SecureCRT 连接 Ubuntu 成功。
在VMWare中安装了Ubuntu16.04,想要 Win10 中通过 SecureCRT 来操作
标签:
原文地址:http://www.cnblogs.com/91program/p/5809005.html