我能够在Chrome上呈现虚拟机的公共IP,但无法将其与SSH连接,引发错误:连接到主机xxx.xxx.xxx.xx端口22:连接拒绝了。当我在Portal上检查虚拟机时,没有安全组分配给它。这与此有关吗?我该如何解决它?在azure上拒绝SSH连接vm
回答
根据你的描述,如果我们想ssh到泊坞窗形象,我们应该在该图像上安装SSH,所开放的端口为这个形象,我将运行CentOS的形象的比方:
docker pull centos:centos6
docker run -i -t centos:centos6
yum install openssh-server openssh-client(install ssh)
chkconfig sshd on
passwd(reset root password)
exit
docker commit 332b19ca916c centos/centosssh (commit this image)
docker run -i -t -d -p 50001:22 centos/centosssh (NAT for this container)
docker attach containerid (connect this container)
vi /etc/ssh/sshd_config (modify sshd config)
change UsePAM to no
service sshd start
然后打开Azure NSG中的端口50001。
这个时候,我们就可以使用SSH连接它:
更新:
我使用CLI 2.0创建的VM泊坞窗延伸,并改变公共IP地址静,并使用命令sudo docker run -d -p 80:80 nginx
在虚拟机上运行容器。然后使用铬来测试nginx,它工作正常,我可以ssh到Azure VM 公共IP和FQDN。 nginx的容器:
[email protected]:~$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
61e10ebb6d22 nginx "nginx -g 'daemon ..." 4 minutes ago Up 4 minutes 0.0.0.0:80->80/tcp, 443/tcp kind_leavitt
尝试使用FQDN到SSH主机:
[c:\~]$ ssh [email protected]
Host 'mypublicdns.eastus.cloudapp.azure.com' resolved to 52.186.123.151.
Connecting to 52.186.123.151:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
Welcome to Ubuntu 14.04.4 LTS (GNU/Linux 3.19.0-65-generic x86_64)
* Documentation: https://help.ubuntu.com/
System information as of Fri Apr 7 06:40:06 UTC 2017
System load: 0.31 Processes: 118
Usage of /: 5.8% of 28.80GB Users logged in: 1
Memory usage: 12% IP address for eth0: 10.0.0.4
Swap usage: 0% IP address for docker0: 172.17.0.1
尝试使用公共IP地址的ssh主机:
[c:\~]$ ssh [email protected]
Connecting to 52.186.123.151:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
Welcome to Ubuntu 14.04.4 LTS (GNU/Linux 3.19.0-65-generic x86_64)
* Documentation: https://help.ubuntu.com/
System information as of Fri Apr 7 06:40:55 UTC 2017
System load: 0.21 Processes: 119
Usage of /: 5.8% of 28.80GB Users logged in: 1
Memory usage: 12% IP address for eth0: 10.0.0.4
Swap usage: 0% IP address for docker0: 172.17.0.1
我有更新我的答案,它工作正常,请检查它。 –
如果你运行docker镜像并仍然不能ssh到Azure VM,也许我们可以尝试使用** reset ssh configuration **,我们可以在这里找到reset ssh config,选择VM - > reset password ---> in该模式下,选择**仅重置配置**。 –
所以它工作。那么它应该工作。非常感谢杰森 – Gene9y
- 1. ssh连接拒绝
- 2. ssh wget连接被拒绝
- 3. aws ssh连接被拒绝
- 4. 无法连接到Azure Ubuntu VM - 公钥被拒绝
- 5. SSh:连接拒绝到本地主机
- 6. ssh连接被拒绝,但ping成功
- 7. SSH连接拒绝从centos到debian
- 8. 更改端口后SSH连接拒绝
- 9. ssh:端口22拒绝连接
- 10. 反向SSH连接被拒绝
- 11. Eclipse:无法连接到远程VM。拒绝连接。
- 12. 的DataDirect ODBC Azure的连接被拒绝
- 13. 拒绝连接[RequestHttps]上MVC3
- 14. 拒绝连接
- 15. 拒绝连接?
- 16. 从另一个Azure VM连接到Azure VM上的mongodb
- 17. 的ssh:连接到主机heroku.com端口22:连接被拒绝
- 18. ssh:连接到主机localhost端口2222:连接被拒绝
- 19. 端口22上拒绝DC/OS ssh连接 - 预检
- 20. Rserve:拒绝连接:连接
- 21. 拒绝连接:连接jijerster
- 22. 无法连接到Azure上的Linux VM
- 23. 拒绝连接Go + Postgres在Heroku上
- 24. Redoku在Heroku上拒绝连接
- 25. 在Nexus 5X上拒绝TCP连接
- 26. 如何在vm中连接ssh
- 27. Apache拒绝连接
- 28. KSOAP2 - 拒绝连接
- 29. SignalR拒绝连接
- 30. Cassandra拒绝连接
可以TELENT天青VM端口22从您的本地PC? –
无法在Windows 10上使用telnet .Http端口正在工作,但不是ssh端口。 – Gene9y
不能telnet azure虚拟机或不能使用telnet这个命令? –