From Ubuntu 18 lts I'm trying to establish ssh connection with my Kali Linux VirtualBox on the same computer. I've already installed openssh-client and openssh-server on both systems and I'm connected to Internet via ethernet cable. So, I have 'enp2s0' interface (on both systems) which is found in 'ifconfig' and I changed my network ipv4 addresses to static with the same IP addresses I found in 'ifconfig':
In Ubuntu:
IP: 192.168.1.8
In Kali:
IP: 192.168.1.5
Netmask: 255.255.255.0 and Default Gateway: 192.168.1.255 are same on both systems. In VBox settings for Kali I configured network to Bridge connection. I checked ping between these systems and it is ok (64bytes..blahblah). I turned off firewall on both systems:
sudo ufw disable
so it's inactive. The problem is that, I can connect from Kali shell to Ubuntu, but not vice versa where I'm getting the following message:
ssh: connect to host 192.168.1.5 port 22: Connection refused
I also tried with: sudo ufw allow 22 on both and nothing.
sudo ufw ssh enable didn't help.
Answers on comments:
netstat -an | grep 22
gives me:
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 69 0 192.168.1.8:53436 13.32.28.22:443 ESTABLISHED
tcp6 0 0 :::22 :::* LISTEN
unix 2 [ ] DGRAM 3766327 /var/lib/samba/private/msg.sock/922
unix 2 [ ] DGRAM 3805225 /run/wpa_supplicant/wlp3s0mon
unix 3 [ ] STREAM CONNECTED 2717922 /run/user/1000/bus
unix 3 [ ] STREAM CONNECTED 2869722
unix 3 [ ] STREAM CONNECTED 3802265
unix 3 [ ] STREAM CONNECTED 3802266
unix 3 [ ] STREAM CONNECTED 2335221
unix 3 [ ] STREAM CONNECTED 2341225 /var/run/dbus/system_bus_socket
unix 3 [ ] STREAM CONNECTED 1822 /run/systemd/journal/stdout
unix 3 [ ] STREAM CONNECTED 3773622
unix 3 [ ] STREAM CONNECTED 27122 /run/user/121/bus
unix 3 [ ] STREAM CONNECTED 3802298
unix 3 [ ] STREAM CONNECTED 3802297
unix 3 [ ] STREAM CONNECTED 2468922
unix 2 [ ] DGRAM 2339422
unix 3 [ ] STREAM CONNECTED 2332622
unix 3 [ ] STREAM CONNECTED 3853822
unix 3 [ ] STREAM CONNECTED 29227
unix 3 [ ] STREAM CONNECTED 29228
unix 3 [ ] STREAM CONNECTED 2329522
unix 3 [ ] STREAM CONNECTED 3766622
unix 3 [ ] STREAM CONNECTED 2329922
unix 3 [ ] STREAM CONNECTED 28122 /run/systemd/journal/stdout
unix 3 [ ] STREAM CONNECTED 2888122
netstat -an | grep 22
192.168.1.255
, which is the last address of the subnet, is, by definition, the broadcast address and can't be the default gateway. Something is wrong in your configuration.ssh -vvv <host-or-ip>
to get more verbose report. I'm not familiar with Kali but UFW is front-end for IPTables, so try to remove alliptables
rules, maybe there still something.sudo apt install openssh-server
You said you already installed it but just incase.sudo systemctl start sshd
and then verify 22 is listening with that same netstat command.