SSH连接虚拟机乌班图

  • 环境准备
    VMware/Ubuntu/Xshell

  • 创建镜像

  • 镜像配置
Ctrl+Alt+T	打开终端
[email protected]:/$	ping www.baidu.com	//默认桥接是通的
[email protected]:/$	sudo ufw disable
[sudo] password for root:	在此输入密码
[email protected]:/$	sudo apt-get install openssh-server openssh-client	//安装Openssh,字面意思
  • 查看22端口
[email protected]:~$ netstat -tnl 
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 127.0.1.1:53            0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN     
tcp6       0      0 :::22                   :::*                    LISTEN     
tcp6       0      0 ::1:631                 :::*                    LISTEN     
  • 配置ssh连接客户端用户名和镜像用户名一致
    SSH连接虚拟机乌班图
  • 新建SSH连接,输入用户名密码
    SSH连接虚拟机乌班图
    登录成功
    总结一共需要两步:
    A:关闭防火墙
    B:开放SSH连接22端口