Can't SSH to VM


Ken

I have a VM installed and some custom disk images (CentOS) at work, but I can't SSH into the VM.

Here are some things I've tried:

[VM]$ ssh root@localhost
Password:

Great, ssh is using loopback.

But when I try from host:

~/VirtualBox VMs% ssh -v -v -v [email protected]
OpenSSH_5.9p1, OpenSSL 0.9.8y 5 Feb 2013
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 192.168.56.1 [192.168.56.1] port 22.
debug1: connect to address 192.168.56.1 port 22: Connection refused
ssh: connect to host 192.168.56.1 port 22: Connection refused

Nada Although Ping works.

On the VM, /etc/hosts.allow:

ssh:ALL:allow
sshd:ALL:allow

nothing in hosts.deny

Edit:
I also did:

service iptables save
service iptables stop
chkconfig iptables off

EDIT:
I'm also seeing this message on the VM at /var/log/secure,
Bind to port conflict
but I can switch ssh between the VM and ssh, so that's not a problem right?

edit:[VM]$ lsof -i :22 lsof -i:22 output

I am in /etc/ssh/sshd_config

PermitRootLogin yes  

and cannot log in with a separate username.

EDIT:
netstat -pant |grep :22And netstat -ntp |grep :22 netstat -pant和netstat -ntp
I thought, maybe a solution for IPv6 that also points?

EDIT:
Existing configurationvi /etc/sysctl.conf /etc/sysctl.conf

vi /etc/sysctl.conf Changed /etc/sysctl.confmy new config and then run the command:

sysctl -w net.ipv6.conf.default.disable_ipv6=1
sysctl -w net.ipv6.conf.all.disable_ipv6=1
chkconfig ip6tables off
service sshd restart
init 6

Aaaaaaand, still nothing. But after rebooting, ipv6 doesn't seem to be disabled. I get the same error message. Unable to bind port 22and lsof -i :22still say IPv6 type:lsof -i:22

Edit: Further down the IPv6 rabbit hole.
http://ubuntu-tutorials.com/2008/01/12/disabling-ssh-connections-on-ipv6/
says to remove the commented line with #ListenAddress ::, seems a bit suspicious since it is already commented. So I did it and got nothing.

However, the next section has a useful tidbit: AddressFamily inet # IPv4 only When I add this line to /etc/ssh/sshd_config and do a couple consecutive restarts, I now see that my address binding error has stopped appearing in /var/log/secure /var/log/safe
and the output of lsof -i :22 now shows a type of IPv4! Yes, progress!  lsof -i:22 shows IPv4 Progress!! But unfortunately I still cannot connect. I tried rebooting the VM, opening new shell windows just in case there was some state left hanging around. Still the same answer.

~% ssh -vvv [email protected]
OpenSSH_5.9p1, OpenSSL 0.9.8y 5 Feb 2013
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 192.168.56.1 [192.168.56.1] port 22.
debug1: connect to address 192.168.56.1 port 22: Connection refused
ssh: connect to host 192.168.56.1 port 22: Connection refused

EDIT:
ok, so i got arp-scan and am trying to find IP conflicts, but now i'm even more confused. ifconfig shows that vboxnet0, which is the host-only adapter, has an IP of 192.168.56.1. That's where I got that IP to begin with.

[local]~root# ifconfig  
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
    options=3<RXCSUM,TXCSUM>
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 
    inet 127.0.0.1 netmask 0xff000000 
    inet6 ::1 prefixlen 128 
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    ether 7c:d1:c3:e8:b0:e9 
    inet6 fe80::7ed1:c3ff:fee8:b0e9%en0 prefixlen 64 scopeid 0x4 
    inet 10.6.12.46 netmask 0xfffffe00 broadcast 10.6.13.255
    media: autoselect
    status: active
p2p0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 2304
    ether 0e:d1:c3:e8:b0:e9 
    media: autoselect
    status: inactive
vboxnet0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    ether 0a:00:27:00:00:00 
    inet 192.168.56.1 netmask 0xffffff00 broadcast 192.168.56.255
vboxnet1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    ether 0a:00:27:00:00:01 
    inet 192.168.57.1 netmask 0xffffff00 broadcast 192.168.57.255

But arp-scan -l gives only domains starting with 10.6.*.*
So I guess it's looking at en0? So I tried
arp-scan -I vboxnet0 -l

mba-108-on-03:~ root# arp-scan -I vboxnet0 -l
Interface: vboxnet0, datalink type: EN10MB (Ethernet)
Starting arp-scan 1.8 with 256 hosts (http://www.nta-monitor.com/tools/arp-scan/)
192.168.56.100  08:00:27:bc:ed:2f   CADMUS COMPUTER SYSTEMS

512 packets received by filter, 0 packets dropped by kernel
Ending arp-scan 1.8: 256 hosts scanned in 1.301 seconds (196.77 hosts/sec). 1 responded

Why is it now .100? #confused

vboxnet1 has nothing

mba-108-on-03:~ root# arp-scan -I vboxnet1 -l
Interface: vboxnet1, datalink type: EN10MB (Ethernet)
Starting arp-scan 1.8 with 256 hosts (http://www.nta-monitor.com/tools/arp-scan/)

512 packets received by filter, 0 packets dropped by kernel
Ending arp-scan 1.8: 256 hosts scanned in 1.302 seconds (196.62 hosts/sec). 0 responded

All of the other interfaces don't work with arp-scan.

So let's show duplicates on the en0 interface:

mba-108-on-03:~ root# arp-scan -I en0 -l |grep DUP
10.6.12.68  84:8e:0c:75:5b:f4   (Unknown) (DUP: 2)
10.6.12.64  ac:cf:5c:42:24:47   (Unknown) (DUP: 2)
10.6.12.76  88:53:95:6e:6a:af   (Unknown) (DUP: 2)

These numbers don't correspond to anything meaningful for me. Going to try a reboot, then the IPv6 suggestion.

EDIT:
The VM is a VirtualBox.
Adapter 1: NAT
Adapter 2: Host-only Adapter, 'vboxnet0' Configuration of adapter1 Configuration of adapter2
Any ideas?

Ken

Ok, here's how it finally came together:

One of my coworkers recalled that the disk image "might not have a second interface enabled." Since the VBox is set up with NAT as adapter one and Host-only as adapter two, you need to have eth0 and eth1 set up on the disk image. We did not.

To do this:

  • verify that ifconfig |less does not have both eth0 and eth1 listed.
  • cd /etc/sysconfig/network-scripts/
  • cp ifcfg-eth0 ifcfg-eth1
  • cp ifcfg-eth0.bak ifcfg-eth1.bak
  • Edit the file and delete everything using HWaddrand change eth0 to eth1ifcfg-eth1
  • ifup eth1
  • Then run ifconfigand use inet addreth1, which is a different IP for me. I am using 192.168.56.101.
  • Please do an init 6 reboot and make sure eth1 starts automatically now.
  • Log in from the host:ssh [email protected]

All the edits in the question above are not actually my problem, but it's all good debug info!

Cheers,
Ken

Related


Can't SSH to VM

Ken I have a VM installed and some custom disk images (CentOS) at work, but I can't SSH into the VM. Here are some things I've tried: [VM]$ ssh root@localhost Password: Great, ssh is using loopback. But when I try from host: ~/VirtualBox VMs% ssh -v -v -v roo

Can't SSH to Azure VM

Samas Agarwal I have an Ubuntu VM (resource group, not Classic VM) on Azure and it's all available. I recently tried to SSH into a VM using Putty, but I couldn't. I get the error: Network Error: Connection Timed out. I've made sure port 22 is open for SSH in t

Can't SSH to Azure VM

Samas Agarwal I have an Ubuntu VM (resource group, not Classic VM) on Azure and it's all available. I recently tried to SSH into a VM using Putty, but I couldn't. I get the error: Network Error: Connection Timed out. I've made sure port 22 is open for SSH in t

Can't SSH to Azure VM

Samas Agarwal I have an Ubuntu VM (resource group, not Classic VM) on Azure and it's all available. I recently tried to SSH into a VM using Putty, but I couldn't. I get the error: Network Error: Connection Timed out. I've made sure port 22 is open for SSH in t

Can't SSH to Azure VM

Samas Agarwal I have an Ubuntu VM (resource group, not Classic VM) on Azure and it's all available. I recently tried to SSH into a VM using Putty, but I couldn't. I get the error: Network Error: Connection Timed out. I've made sure port 22 is open for SSH in t

Can't SSH to Azure VM

Samas Agarwal I have an Ubuntu VM (resource group, not Classic VM) on Azure and it's all available. I recently tried to SSH into a VM using Putty, but I couldn't. I get the error: Network Error: Connection Timed out. I've made sure port 22 is open for SSH in t

Google VM Instant - Can't access SSH

Jeff I have installed ERPNext from Google Click to Deploy since 6 months ago and with that software it worked until last week until I lost access to the system and SSH When connecting using SSH, the system shows that connecting through the Cloud Identity-Aware

Can't SSH into Azure Windows Server VM

Angelson I created a new virtual machine in Azure. (Windows Server 2016 Datacenter Server Core) The VM creation process enabled me to enable SSH access (and it did): Image of VM Creation Wizard However, I found myself unable to establish an SSH connection to W

Can't SSH to Debian VM from Ubuntu

burakcan.yurttutan I can't connect to Debian 9 Server from Ubuntu OS. Debian 9 is a Virtualbox VM. I modified sshd_configand added new user server1on deb server . The Openssh server is setup on the deb server. Deb server is listening on 0.0.0.0 and -p 22. Alth

Bluemix VM can't connect via SSH

Howard Liu As my thread states, I can't connect to the server via ssh, but I can connect to the server via Horizon. My region is USA. I tried CentOS 7 and Ubuntu 14.10 provided by Bluemix. I use a security group to enable all data (either ipv4 or ipv6, whateve

Can't SSH into Azure Windows Server VM

Angelson I created a new virtual machine in Azure. (Windows Server 2016 Datacenter Server Core) The VM creation process enabled me to enable SSH access (and it did): Image of VM Creation Wizard However, I found myself unable to establish an SSH connection to W

I can't SSH into my Ubuntu VM

Unais221 So I went through the notes and tried to install an Oracle virtual machine that could run Ubuntu. Also, I'm having issues with SSH and the long details of the setup process are a bit vague. But I think I did it correctly, mainly setting the sshd_confi

Google VM Instant - Can't access SSH

Jeff I've installed ERPNext from Google Click to Deploy since 6 months ago and with that software it worked until last week until I lost access to the system and SSH When connecting using SSH, the system shows that connecting through the Cloud Identity-Aware p

Can't SSH into Azure Windows Server VM

Angelson I created a new virtual machine in Azure. (Windows Server 2016 Datacenter Server Core) The VM creation process enabled me to enable SSH access (and it did): Image of VM Creation Wizard However, I found myself unable to establish an SSH connection to W

Can't SSH to Debian VM from Ubuntu

burakcan.yurttutan I can't connect to Debian 9 Server from Ubuntu OS. Debian 9 is a Virtualbox VM. I modified sshd_configand added new user server1on deb server . The Openssh server is setup on the deb server. Deb server is listening on 0.0.0.0 and -p 22. Alth

Bluemix VM can't connect via SSH

Howard Liu As my thread states, I can't connect to the server via ssh, but I can connect to the server via Horizon. My region is USA. I tried CentOS 7 and Ubuntu 14.10 provided by Bluemix. I use a security group to enable all data (either ipv4 or ipv6, whateve

Can't SSH into Azure Windows Server VM

Angelson I created a new virtual machine in Azure. (Windows Server 2016 Datacenter Server Core) The VM creation process enabled me to enable SSH access (and it did): Image of VM Creation Wizard However, I found myself unable to establish an SSH connection to W

Google VM Instant - Can't access SSH

Jeff I have installed ERPNext from Google Click to Deploy since 6 months ago and with that software it worked until last week until I lost access to the system and SSH When connecting using SSH, the system shows that connecting through the Cloud Identity-Aware

I can't SSH into my Ubuntu VM

Unais221 So I went through the notes and tried to install an Oracle virtual machine that could run Ubuntu. Also, I'm having issues with SSH and the long details of the setup process are a bit vague. But I think I did it correctly, mainly setting the sshd_confi

Google VM Instant - Can't access SSH

Jeff I've installed ERPNext from Google Click to Deploy since 6 months ago and with that software it worked until last week until I lost access to the system and SSH When connecting using SSH, the system shows that connecting through the Cloud Identity-Aware p

Can't SSH into Vagrant VM (without using vagrant ssh)

Sloan Ahrens In preparation for adapting the fabric deployment script for use by a local Vagrant VM, I'm trying to convince the VM to let me SSH into it without using SSH vagrant ssh. I keep getting errors. I've tried many different combinations of settings, b

Can't SSH into Vagrant VM (without using vagrant ssh)

Sloan Ahrens In preparation for adapting the fabric deployment script for use by a local Vagrant VM, I'm trying to convince the VM to let me SSH into it without using SSH vagrant ssh. I keep getting errors. I've tried many different combinations of settings, b

Can't SSH into Vagrant VM (without using vagrant ssh)

Sloan Ahrens In preparation for adapting the fabric deployment script for use by a local Vagrant VM, I'm trying to convince the VM to let me SSH into it without using SSH vagrant ssh. I keep getting errors. I've tried many different combinations of settings, b

Can't SSH into Vagrant VM (without using vagrant ssh)

Sloan Ahrens In preparation for adapting the fabric deployment script for use by a local Vagrant VM, I'm trying to convince the VM to let me SSH into it without using SSH vagrant ssh. I keep getting errors. I've tried many different combinations of settings, b

Can't SSH to VM from Windows 10 (it worked before)

Shamir I'm running an Ubuntu 14 VM in Oracle Virtual Box on my host Windows 10 machine for a university assignment running mininet. Everything was working fine until one day I woke up and tried to ssh into the VM and let me log in (with a welcome message), but

Can't SSH into a previously working GCP VM instance

keying I created some GCP VM instances yesterday, all with the same configuration but running different tasks. I can SSH into these instances via the GCP console and they all work fine. Today, I wanted to check if the task is complete, but I can no longer SSH

Can't SSH to Google Cloud VM after installing MySQL

Josh Greenlaw I'm trying to setup a small blog server on Google Cloud Platform using a free f1.micro instance. I'm using Ubuntu 20.04 LTS as the base image (Ubuntu is the only Linux distribution I'm completely familiar with), although I tried 20.10. Everything

Can't SSH into a previously working GCP VM instance

keying I created some GCP VM instances yesterday, all with the same configuration but running different tasks. I can SSH into these instances via the GCP console and they all work fine. Today, I wanted to check if the task is complete, but I can no longer SSH

Can't SSH to Google Cloud VM after installing MySQL

Josh Greenlaw I'm trying to setup a small blog server on Google Cloud Platform using a free f1.micro instance. I'm using Ubuntu 20.04 LTS as the base image (Ubuntu is the only Linux distribution I'm completely familiar with), although I tried 20.10. Everything