记录一下Ubuntu17.10的openssh-server的安装和使用。安装之后就可以使用ssh登陆Ubuntu了,所以是Ubuntu的基础设定之一。

事前准备
Ubuntu版本:17.10

devops@ubuntu:~$ cat   /etc/issue
Ubuntu 17.10 \n \l


devops@ubuntu:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 17.10
Release:    17.10
Codename:   artful
devops@ubuntu:~$ 

17.10的Ubuntu代号Artful Aardvark,于2017年10月19日正式发布,是更换GNOME的首个版本,但是这不是一个LTS版本,会支持到2018年8月,是2018年Ubuntu的LTS的版本之前的过渡版本。openssh-server的安装基本上对于Ubuntu的版本影响非常低,基本操作步骤大体一致。

安装步骤
按照如下安装步骤进行安装


操作日志
此处再以安装的状态下抓取的日志,apt install显示会有所不同

devops@ubuntu:~$ sudo su
[sudo] password for devops: 
root@ubuntu:/home/devops# 
root@ubuntu:/home/devops# apt install openssh-server
Reading package lists... Done
Building dependency tree       
Reading state information... Done
openssh-server is already the newest version (1:7.5p1-10ubuntu0.1).
0 upgraded, 0 newly installed, 0 to remove and 55 not upgraded.
root@ubuntu:/home/devops# 
root@ubuntu:/home/devops# ssh -V
OpenSSH_7.5p1 Ubuntu-10ubuntu0.1, OpenSSL 1.0.2g  1 Mar 2016
root@ubuntu:/home/devops# 
root@ubuntu:/home/devops# /etc/init.d/ssh  status
● ssh.service - OpenBSD Secure Shell server
   Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2018-03-03 07:58:44 CST; 51min ago
  Process: 3072 ExecReload=/bin/kill -HUP $MAINPID (code=exited, status=0/SUCCESS)
  Process: 3071 ExecReload=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
  Process: 3167 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
 Main PID: 3179 (sshd)
    Tasks: 1 (limit: 4915)
   Memory: 1.0M
      CPU: 7ms
   CGroup: /system.slice/ssh.service
           └─3179 /usr/sbin/sshd -D

Mar 03 07:58:44 ubuntu systemd[1]: Starting OpenBSD Secure Shell server...
Mar 03 07:58:44 ubuntu systemd[1]: Started OpenBSD Secure Shell server.
Mar 03 07:58:44 ubuntu sshd[3179]: Server listening on 0.0.0.0 port 22.
Mar 03 07:58:44 ubuntu sshd[3179]: Server listening on :: port 22.
root@ubuntu:/home/devops# 
root@ubuntu:/home/devops# sudo  /etc/init.d/ssh  restart
[ ok ] Restarting ssh (via systemctl): ssh.service.
root@ubuntu:/home/devops# 

从终端进行ssh连接

liumiaocn:~ liumiao$ sudo  ssh devops@192.168.31.19
devops@192.168.31.19's password: 
Welcome to Ubuntu 17.10 (GNU/Linux 4.13.0-21-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage


58 packages can be updated.
32 updates are security updates.


Last login: Sat Mar  3 07:43:23 2018 from 192.168.31.242
devops@ubuntu:~$

————————————————
版权声明:本文为CSDN博主「liumiaocn」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/liumiaocn/article/details/79427964

================================================================================

windows下使用 secureCRT  连接

1、首先保证二者可以ping通。(无论是否是虚拟机)

2、打开secureCRT,点击File-》Quick Connect

3、

使用 putty 连接也行。

 


1.安装SSH

如果你用的是redhat,fedora,centos等系列linux发行版,那么敲入以下命令:
sudo yum install sshd 或
sudo yum install openssh-server(由osc网友 火耳提供)

如果你使用的是debian,ubuntu,linux mint等系列的linux发行版,那么敲入以下命令:
sudo apt-get install sshd 或
sudo apt-get install openssh-server(由osc网友 火耳提供)

然后按照提示,安装就好了。

2.开启ssh服务

sudo  service  sshd  start
sudo  /etc/init.d/   ssh  restart


3.卸载服务

如果你用的是redhat,fedora,centos等系列linux发行版,那么敲入以下命令:
yum remove sshd
如果你使用的是debian,ubuntu,linux mint等系列的linux发行版,那么敲入以下命令:
sudo  apt-get  –purge  remove  sshd

 

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐