Cannot ssh into VirtualBox CentOS 7 guest from Debian host











up vote
0
down vote

favorite












I have a Debian 9 host. I can ssh into my Raspberry Pi and other servers with no issue. I have openSUSE installed as a virtual machine in VirtualBox. I can ssh into that virtual machine with no issue. To set this up in VirtualBox, I went to: Settings > Network > Advanced > Port Forwarding > Name: ssh, Protocol: TCP, Host IP: (blank), Host Port: (random high port number), Guest IP: (blank), Guest Port: 22. This is for Adapter 1 and it is "Attached to: NAT." These instructions are on a few different forum posts. I have done the same thing for my CentOS virtual machine but with a different Host Port (random high port number). I have made sure the sshd service is running with sudo systemctl status sshd. However, I am unable to ssh into the CentOS virtual machine. I receive the following error (last line below):



~$ ssh -p 1820 CentosUser@127.0.0.1 -v
OpenSSH_7.4p1 Debian-10, OpenSSL 1.0.2k 26 Jan 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 127.0.0.1 [127.0.0.1] port 1820.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /home/brock/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/brock/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/brock/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/brock/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/brock/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/brock/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/brock/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/brock/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4p1 Debian-10
ssh_exchange_identification: read: Connection reset by peer


The issue has to do with how CentOS is configured for its networking or ssh. The CentOS VM has no issue connecting to the internet. It seems this could be an easy test for someone with VirtualBox. The CentOS minimal iso is 680 MB.



Here is the /var/log/secure output for today when I've tried to ssh in with both my user and root.



May 31 00:58:03 localhost sshd[1141]: Server listening on 0.0.0.0 port 22.
May 31 00:58:03 localhost sshd[1141]: Server listening on :: port 22.
May 31 00:58:14 localhost login: pam_unix(login:session): session opened for user root by LOGIN(uid=0)
May 31 00:58:14 localhost login: ROOT LOGIN ON tty1
May 31 00:58:22 localhost polkitd[656]: Registered Authentication Agent for unix-process:2529:3738 (system bus name :1.30 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
May 31 00:58:23 localhost login: pam_unix(login:session): session closed for user root
May 31 00:58:23 localhost polkitd[656]: Unregistered Authentication Agent for unix-process:2529:3738 (system bus name :1.30, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
May 31 00:58:25 localhost gdm-launch-environment]: pam_unix(gdm-launch-environment:session): session opened for user gdm by (uid=0)
May 31 00:58:27 localhost polkitd[656]: Registered Authentication Agent for unix-session:c1 (system bus name :1.55 [gnome-shell --mode=gdm], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
May 31 00:58:39 localhost gdm-password]: pam_unix(gdm-password:session): session opened for user jbc by (unknown)(uid=0)
May 31 00:58:40 localhost gdm-launch-environment]: pam_unix(gdm-launch-environment:session): session closed for user gdm
May 31 00:58:40 localhost polkitd[656]: Unregistered Authentication Agent for unix-session:c1 (system bus name :1.55, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
May 31 00:58:40 localhost polkitd[656]: Registered Authentication Agent for unix-session:2 (system bus name :1.69 [/usr/libexec/xfce-polkit], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
May 31 00:59:30 localhost sudo: jbc : user NOT in sudoers ; TTY=pts/0 ; PWD=/home/jbc ; USER=root ; COMMAND=/bin/yum remove --purge chromium
May 31 00:59:42 localhost su: pam_unix(su-l:session): session opened for user root by jbc(uid=1000)
May 31 01:15:18 localhost polkitd[656]: Registered Authentication Agent for unix-process:4582:105315 (system bus name :1.86 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
May 31 12:58:19 localhost polkitd[659]: Loading rules from directory /etc/polkit-1/rules.d
May 31 12:58:19 localhost polkitd[659]: Loading rules from directory /usr/share/polkit-1/rules.d
May 31 12:58:19 localhost polkitd[659]: Finished loading, compiling and executing 4 rules
May 31 12:58:19 localhost polkitd[659]: Acquired the name org.freedesktop.PolicyKit1 on the system bus
May 31 12:58:29 localhost sshd[1139]: Server listening on 0.0.0.0 port 22.
May 31 12:58:29 localhost sshd[1139]: Server listening on :: port 22.
May 31 12:58:52 localhost login: pam_unix(login:session): session opened for user jbc by LOGIN(uid=0)
May 31 12:58:52 localhost login: LOGIN ON tty1 BY jbc
May 31 13:02:01 localhost polkitd[659]: Registered Authentication Agent for unix-process:2581:22909 (system bus name :1.34 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
May 31 13:02:04 localhost polkitd[659]: Operator of unix-process:2581:22909 successfully authenticated as unix-user:root to gain TEMPORARY authorization for action org.freedesktop.systemd1.manage-units for system-bus-name::1.35 [init 5] (owned by unix-user:jbc)
May 31 13:02:05 localhost polkitd[659]: Unregistered Authentication Agent for unix-process:2581:22909 (system bus name :1.34, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
May 31 13:02:05 localhost login: pam_unix(login:session): session closed for user jbc
May 31 13:02:06 localhost gdm-launch-environment]: pam_unix(gdm-launch-environment:session): session opened for user gdm by (uid=0)
May 31 13:02:09 localhost polkitd[659]: Registered Authentication Agent for unix-session:c1 (system bus name :1.64 [gnome-shell --mode=gdm], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
May 31 13:02:15 localhost gdm-password]: pam_unix(gdm-password:session): session opened for user jbc by (unknown)(uid=0)
May 31 13:02:16 localhost gdm-launch-environment]: pam_unix(gdm-launch-environment:session): session closed for user gdm
May 31 13:02:16 localhost polkitd[659]: Unregistered Authentication Agent for unix-session:c1 (system bus name :1.64, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
May 31 13:02:17 localhost polkitd[659]: Registered Authentication Agent for unix-session:4 (system bus name :1.78 [/usr/libexec/xfce-polkit], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
May 31 13:02:33 localhost su: pam_unix(su-l:session): session opened for user root by jbc(uid=1000)
May 31 13:03:18 localhost polkitd[659]: Registered Authentication Agent for unix-process:4348:30623 (system bus name :1.87 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
May 31 13:03:18 localhost polkitd[659]: Unregistered Authentication Agent for unix-process:4348:30623 (system bus name :1.87, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)


Also, /var/log/secure ssh related:



[root@localhost ~]# cat /var/log/secure | grep "May 31" | grep ssh
May 31 00:58:03 localhost sshd[1141]: Server listening on 0.0.0.0 port 22.
May 31 00:58:03 localhost sshd[1141]: Server listening on :: port 22.
May 31 12:58:29 localhost sshd[1139]: Server listening on 0.0.0.0 port 22.
May 31 12:58:29 localhost sshd[1139]: Server listening on :: port 22.









share|improve this question
























  • what logs are in the server log (/var/log/secure)?
    – Jakuje
    May 31 '17 at 6:45










  • if SSH is correctly running, it'll likely be one of two things; 1) check that the server is listening over ssh with netstat -tulnp | grep 80 2) check firewalld isn't blocking traffic - you can quickly test by turning firewalld off: systemctl stop firewalld or just force open the port: firewall-cmd --zone=public --add-port=22/tcp --permanent
    – RobotJohnny
    May 31 '17 at 10:04












  • @RobotJohnny The debug output says that the ssh session successfully established a connection to the destination and on the correct port. That should rule out firewalld and SELinux port type ssh_port_t (which would have thrown permission denied errors if the new port wasn't added or a new type created)
    – Rabban
    May 31 '17 at 10:12










  • Try to increase the verbosity of your ssh connection by using the -vvv flag instead. That might provide additional clues. Apart from that, all we can do is speculate.
    – Rabban
    May 31 '17 at 10:13










  • @Rabban I had already tried -vvv which does not give us any additional information unfortunately.
    – jbrock
    May 31 '17 at 18:15















up vote
0
down vote

favorite












I have a Debian 9 host. I can ssh into my Raspberry Pi and other servers with no issue. I have openSUSE installed as a virtual machine in VirtualBox. I can ssh into that virtual machine with no issue. To set this up in VirtualBox, I went to: Settings > Network > Advanced > Port Forwarding > Name: ssh, Protocol: TCP, Host IP: (blank), Host Port: (random high port number), Guest IP: (blank), Guest Port: 22. This is for Adapter 1 and it is "Attached to: NAT." These instructions are on a few different forum posts. I have done the same thing for my CentOS virtual machine but with a different Host Port (random high port number). I have made sure the sshd service is running with sudo systemctl status sshd. However, I am unable to ssh into the CentOS virtual machine. I receive the following error (last line below):



~$ ssh -p 1820 CentosUser@127.0.0.1 -v
OpenSSH_7.4p1 Debian-10, OpenSSL 1.0.2k 26 Jan 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 127.0.0.1 [127.0.0.1] port 1820.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /home/brock/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/brock/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/brock/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/brock/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/brock/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/brock/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/brock/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/brock/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4p1 Debian-10
ssh_exchange_identification: read: Connection reset by peer


The issue has to do with how CentOS is configured for its networking or ssh. The CentOS VM has no issue connecting to the internet. It seems this could be an easy test for someone with VirtualBox. The CentOS minimal iso is 680 MB.



Here is the /var/log/secure output for today when I've tried to ssh in with both my user and root.



May 31 00:58:03 localhost sshd[1141]: Server listening on 0.0.0.0 port 22.
May 31 00:58:03 localhost sshd[1141]: Server listening on :: port 22.
May 31 00:58:14 localhost login: pam_unix(login:session): session opened for user root by LOGIN(uid=0)
May 31 00:58:14 localhost login: ROOT LOGIN ON tty1
May 31 00:58:22 localhost polkitd[656]: Registered Authentication Agent for unix-process:2529:3738 (system bus name :1.30 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
May 31 00:58:23 localhost login: pam_unix(login:session): session closed for user root
May 31 00:58:23 localhost polkitd[656]: Unregistered Authentication Agent for unix-process:2529:3738 (system bus name :1.30, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
May 31 00:58:25 localhost gdm-launch-environment]: pam_unix(gdm-launch-environment:session): session opened for user gdm by (uid=0)
May 31 00:58:27 localhost polkitd[656]: Registered Authentication Agent for unix-session:c1 (system bus name :1.55 [gnome-shell --mode=gdm], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
May 31 00:58:39 localhost gdm-password]: pam_unix(gdm-password:session): session opened for user jbc by (unknown)(uid=0)
May 31 00:58:40 localhost gdm-launch-environment]: pam_unix(gdm-launch-environment:session): session closed for user gdm
May 31 00:58:40 localhost polkitd[656]: Unregistered Authentication Agent for unix-session:c1 (system bus name :1.55, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
May 31 00:58:40 localhost polkitd[656]: Registered Authentication Agent for unix-session:2 (system bus name :1.69 [/usr/libexec/xfce-polkit], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
May 31 00:59:30 localhost sudo: jbc : user NOT in sudoers ; TTY=pts/0 ; PWD=/home/jbc ; USER=root ; COMMAND=/bin/yum remove --purge chromium
May 31 00:59:42 localhost su: pam_unix(su-l:session): session opened for user root by jbc(uid=1000)
May 31 01:15:18 localhost polkitd[656]: Registered Authentication Agent for unix-process:4582:105315 (system bus name :1.86 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
May 31 12:58:19 localhost polkitd[659]: Loading rules from directory /etc/polkit-1/rules.d
May 31 12:58:19 localhost polkitd[659]: Loading rules from directory /usr/share/polkit-1/rules.d
May 31 12:58:19 localhost polkitd[659]: Finished loading, compiling and executing 4 rules
May 31 12:58:19 localhost polkitd[659]: Acquired the name org.freedesktop.PolicyKit1 on the system bus
May 31 12:58:29 localhost sshd[1139]: Server listening on 0.0.0.0 port 22.
May 31 12:58:29 localhost sshd[1139]: Server listening on :: port 22.
May 31 12:58:52 localhost login: pam_unix(login:session): session opened for user jbc by LOGIN(uid=0)
May 31 12:58:52 localhost login: LOGIN ON tty1 BY jbc
May 31 13:02:01 localhost polkitd[659]: Registered Authentication Agent for unix-process:2581:22909 (system bus name :1.34 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
May 31 13:02:04 localhost polkitd[659]: Operator of unix-process:2581:22909 successfully authenticated as unix-user:root to gain TEMPORARY authorization for action org.freedesktop.systemd1.manage-units for system-bus-name::1.35 [init 5] (owned by unix-user:jbc)
May 31 13:02:05 localhost polkitd[659]: Unregistered Authentication Agent for unix-process:2581:22909 (system bus name :1.34, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
May 31 13:02:05 localhost login: pam_unix(login:session): session closed for user jbc
May 31 13:02:06 localhost gdm-launch-environment]: pam_unix(gdm-launch-environment:session): session opened for user gdm by (uid=0)
May 31 13:02:09 localhost polkitd[659]: Registered Authentication Agent for unix-session:c1 (system bus name :1.64 [gnome-shell --mode=gdm], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
May 31 13:02:15 localhost gdm-password]: pam_unix(gdm-password:session): session opened for user jbc by (unknown)(uid=0)
May 31 13:02:16 localhost gdm-launch-environment]: pam_unix(gdm-launch-environment:session): session closed for user gdm
May 31 13:02:16 localhost polkitd[659]: Unregistered Authentication Agent for unix-session:c1 (system bus name :1.64, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
May 31 13:02:17 localhost polkitd[659]: Registered Authentication Agent for unix-session:4 (system bus name :1.78 [/usr/libexec/xfce-polkit], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
May 31 13:02:33 localhost su: pam_unix(su-l:session): session opened for user root by jbc(uid=1000)
May 31 13:03:18 localhost polkitd[659]: Registered Authentication Agent for unix-process:4348:30623 (system bus name :1.87 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
May 31 13:03:18 localhost polkitd[659]: Unregistered Authentication Agent for unix-process:4348:30623 (system bus name :1.87, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)


Also, /var/log/secure ssh related:



[root@localhost ~]# cat /var/log/secure | grep "May 31" | grep ssh
May 31 00:58:03 localhost sshd[1141]: Server listening on 0.0.0.0 port 22.
May 31 00:58:03 localhost sshd[1141]: Server listening on :: port 22.
May 31 12:58:29 localhost sshd[1139]: Server listening on 0.0.0.0 port 22.
May 31 12:58:29 localhost sshd[1139]: Server listening on :: port 22.









share|improve this question
























  • what logs are in the server log (/var/log/secure)?
    – Jakuje
    May 31 '17 at 6:45










  • if SSH is correctly running, it'll likely be one of two things; 1) check that the server is listening over ssh with netstat -tulnp | grep 80 2) check firewalld isn't blocking traffic - you can quickly test by turning firewalld off: systemctl stop firewalld or just force open the port: firewall-cmd --zone=public --add-port=22/tcp --permanent
    – RobotJohnny
    May 31 '17 at 10:04












  • @RobotJohnny The debug output says that the ssh session successfully established a connection to the destination and on the correct port. That should rule out firewalld and SELinux port type ssh_port_t (which would have thrown permission denied errors if the new port wasn't added or a new type created)
    – Rabban
    May 31 '17 at 10:12










  • Try to increase the verbosity of your ssh connection by using the -vvv flag instead. That might provide additional clues. Apart from that, all we can do is speculate.
    – Rabban
    May 31 '17 at 10:13










  • @Rabban I had already tried -vvv which does not give us any additional information unfortunately.
    – jbrock
    May 31 '17 at 18:15













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I have a Debian 9 host. I can ssh into my Raspberry Pi and other servers with no issue. I have openSUSE installed as a virtual machine in VirtualBox. I can ssh into that virtual machine with no issue. To set this up in VirtualBox, I went to: Settings > Network > Advanced > Port Forwarding > Name: ssh, Protocol: TCP, Host IP: (blank), Host Port: (random high port number), Guest IP: (blank), Guest Port: 22. This is for Adapter 1 and it is "Attached to: NAT." These instructions are on a few different forum posts. I have done the same thing for my CentOS virtual machine but with a different Host Port (random high port number). I have made sure the sshd service is running with sudo systemctl status sshd. However, I am unable to ssh into the CentOS virtual machine. I receive the following error (last line below):



~$ ssh -p 1820 CentosUser@127.0.0.1 -v
OpenSSH_7.4p1 Debian-10, OpenSSL 1.0.2k 26 Jan 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 127.0.0.1 [127.0.0.1] port 1820.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /home/brock/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/brock/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/brock/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/brock/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/brock/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/brock/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/brock/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/brock/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4p1 Debian-10
ssh_exchange_identification: read: Connection reset by peer


The issue has to do with how CentOS is configured for its networking or ssh. The CentOS VM has no issue connecting to the internet. It seems this could be an easy test for someone with VirtualBox. The CentOS minimal iso is 680 MB.



Here is the /var/log/secure output for today when I've tried to ssh in with both my user and root.



May 31 00:58:03 localhost sshd[1141]: Server listening on 0.0.0.0 port 22.
May 31 00:58:03 localhost sshd[1141]: Server listening on :: port 22.
May 31 00:58:14 localhost login: pam_unix(login:session): session opened for user root by LOGIN(uid=0)
May 31 00:58:14 localhost login: ROOT LOGIN ON tty1
May 31 00:58:22 localhost polkitd[656]: Registered Authentication Agent for unix-process:2529:3738 (system bus name :1.30 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
May 31 00:58:23 localhost login: pam_unix(login:session): session closed for user root
May 31 00:58:23 localhost polkitd[656]: Unregistered Authentication Agent for unix-process:2529:3738 (system bus name :1.30, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
May 31 00:58:25 localhost gdm-launch-environment]: pam_unix(gdm-launch-environment:session): session opened for user gdm by (uid=0)
May 31 00:58:27 localhost polkitd[656]: Registered Authentication Agent for unix-session:c1 (system bus name :1.55 [gnome-shell --mode=gdm], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
May 31 00:58:39 localhost gdm-password]: pam_unix(gdm-password:session): session opened for user jbc by (unknown)(uid=0)
May 31 00:58:40 localhost gdm-launch-environment]: pam_unix(gdm-launch-environment:session): session closed for user gdm
May 31 00:58:40 localhost polkitd[656]: Unregistered Authentication Agent for unix-session:c1 (system bus name :1.55, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
May 31 00:58:40 localhost polkitd[656]: Registered Authentication Agent for unix-session:2 (system bus name :1.69 [/usr/libexec/xfce-polkit], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
May 31 00:59:30 localhost sudo: jbc : user NOT in sudoers ; TTY=pts/0 ; PWD=/home/jbc ; USER=root ; COMMAND=/bin/yum remove --purge chromium
May 31 00:59:42 localhost su: pam_unix(su-l:session): session opened for user root by jbc(uid=1000)
May 31 01:15:18 localhost polkitd[656]: Registered Authentication Agent for unix-process:4582:105315 (system bus name :1.86 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
May 31 12:58:19 localhost polkitd[659]: Loading rules from directory /etc/polkit-1/rules.d
May 31 12:58:19 localhost polkitd[659]: Loading rules from directory /usr/share/polkit-1/rules.d
May 31 12:58:19 localhost polkitd[659]: Finished loading, compiling and executing 4 rules
May 31 12:58:19 localhost polkitd[659]: Acquired the name org.freedesktop.PolicyKit1 on the system bus
May 31 12:58:29 localhost sshd[1139]: Server listening on 0.0.0.0 port 22.
May 31 12:58:29 localhost sshd[1139]: Server listening on :: port 22.
May 31 12:58:52 localhost login: pam_unix(login:session): session opened for user jbc by LOGIN(uid=0)
May 31 12:58:52 localhost login: LOGIN ON tty1 BY jbc
May 31 13:02:01 localhost polkitd[659]: Registered Authentication Agent for unix-process:2581:22909 (system bus name :1.34 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
May 31 13:02:04 localhost polkitd[659]: Operator of unix-process:2581:22909 successfully authenticated as unix-user:root to gain TEMPORARY authorization for action org.freedesktop.systemd1.manage-units for system-bus-name::1.35 [init 5] (owned by unix-user:jbc)
May 31 13:02:05 localhost polkitd[659]: Unregistered Authentication Agent for unix-process:2581:22909 (system bus name :1.34, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
May 31 13:02:05 localhost login: pam_unix(login:session): session closed for user jbc
May 31 13:02:06 localhost gdm-launch-environment]: pam_unix(gdm-launch-environment:session): session opened for user gdm by (uid=0)
May 31 13:02:09 localhost polkitd[659]: Registered Authentication Agent for unix-session:c1 (system bus name :1.64 [gnome-shell --mode=gdm], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
May 31 13:02:15 localhost gdm-password]: pam_unix(gdm-password:session): session opened for user jbc by (unknown)(uid=0)
May 31 13:02:16 localhost gdm-launch-environment]: pam_unix(gdm-launch-environment:session): session closed for user gdm
May 31 13:02:16 localhost polkitd[659]: Unregistered Authentication Agent for unix-session:c1 (system bus name :1.64, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
May 31 13:02:17 localhost polkitd[659]: Registered Authentication Agent for unix-session:4 (system bus name :1.78 [/usr/libexec/xfce-polkit], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
May 31 13:02:33 localhost su: pam_unix(su-l:session): session opened for user root by jbc(uid=1000)
May 31 13:03:18 localhost polkitd[659]: Registered Authentication Agent for unix-process:4348:30623 (system bus name :1.87 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
May 31 13:03:18 localhost polkitd[659]: Unregistered Authentication Agent for unix-process:4348:30623 (system bus name :1.87, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)


Also, /var/log/secure ssh related:



[root@localhost ~]# cat /var/log/secure | grep "May 31" | grep ssh
May 31 00:58:03 localhost sshd[1141]: Server listening on 0.0.0.0 port 22.
May 31 00:58:03 localhost sshd[1141]: Server listening on :: port 22.
May 31 12:58:29 localhost sshd[1139]: Server listening on 0.0.0.0 port 22.
May 31 12:58:29 localhost sshd[1139]: Server listening on :: port 22.









share|improve this question















I have a Debian 9 host. I can ssh into my Raspberry Pi and other servers with no issue. I have openSUSE installed as a virtual machine in VirtualBox. I can ssh into that virtual machine with no issue. To set this up in VirtualBox, I went to: Settings > Network > Advanced > Port Forwarding > Name: ssh, Protocol: TCP, Host IP: (blank), Host Port: (random high port number), Guest IP: (blank), Guest Port: 22. This is for Adapter 1 and it is "Attached to: NAT." These instructions are on a few different forum posts. I have done the same thing for my CentOS virtual machine but with a different Host Port (random high port number). I have made sure the sshd service is running with sudo systemctl status sshd. However, I am unable to ssh into the CentOS virtual machine. I receive the following error (last line below):



~$ ssh -p 1820 CentosUser@127.0.0.1 -v
OpenSSH_7.4p1 Debian-10, OpenSSL 1.0.2k 26 Jan 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 127.0.0.1 [127.0.0.1] port 1820.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /home/brock/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/brock/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/brock/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/brock/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/brock/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/brock/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/brock/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/brock/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4p1 Debian-10
ssh_exchange_identification: read: Connection reset by peer


The issue has to do with how CentOS is configured for its networking or ssh. The CentOS VM has no issue connecting to the internet. It seems this could be an easy test for someone with VirtualBox. The CentOS minimal iso is 680 MB.



Here is the /var/log/secure output for today when I've tried to ssh in with both my user and root.



May 31 00:58:03 localhost sshd[1141]: Server listening on 0.0.0.0 port 22.
May 31 00:58:03 localhost sshd[1141]: Server listening on :: port 22.
May 31 00:58:14 localhost login: pam_unix(login:session): session opened for user root by LOGIN(uid=0)
May 31 00:58:14 localhost login: ROOT LOGIN ON tty1
May 31 00:58:22 localhost polkitd[656]: Registered Authentication Agent for unix-process:2529:3738 (system bus name :1.30 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
May 31 00:58:23 localhost login: pam_unix(login:session): session closed for user root
May 31 00:58:23 localhost polkitd[656]: Unregistered Authentication Agent for unix-process:2529:3738 (system bus name :1.30, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
May 31 00:58:25 localhost gdm-launch-environment]: pam_unix(gdm-launch-environment:session): session opened for user gdm by (uid=0)
May 31 00:58:27 localhost polkitd[656]: Registered Authentication Agent for unix-session:c1 (system bus name :1.55 [gnome-shell --mode=gdm], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
May 31 00:58:39 localhost gdm-password]: pam_unix(gdm-password:session): session opened for user jbc by (unknown)(uid=0)
May 31 00:58:40 localhost gdm-launch-environment]: pam_unix(gdm-launch-environment:session): session closed for user gdm
May 31 00:58:40 localhost polkitd[656]: Unregistered Authentication Agent for unix-session:c1 (system bus name :1.55, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
May 31 00:58:40 localhost polkitd[656]: Registered Authentication Agent for unix-session:2 (system bus name :1.69 [/usr/libexec/xfce-polkit], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
May 31 00:59:30 localhost sudo: jbc : user NOT in sudoers ; TTY=pts/0 ; PWD=/home/jbc ; USER=root ; COMMAND=/bin/yum remove --purge chromium
May 31 00:59:42 localhost su: pam_unix(su-l:session): session opened for user root by jbc(uid=1000)
May 31 01:15:18 localhost polkitd[656]: Registered Authentication Agent for unix-process:4582:105315 (system bus name :1.86 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
May 31 12:58:19 localhost polkitd[659]: Loading rules from directory /etc/polkit-1/rules.d
May 31 12:58:19 localhost polkitd[659]: Loading rules from directory /usr/share/polkit-1/rules.d
May 31 12:58:19 localhost polkitd[659]: Finished loading, compiling and executing 4 rules
May 31 12:58:19 localhost polkitd[659]: Acquired the name org.freedesktop.PolicyKit1 on the system bus
May 31 12:58:29 localhost sshd[1139]: Server listening on 0.0.0.0 port 22.
May 31 12:58:29 localhost sshd[1139]: Server listening on :: port 22.
May 31 12:58:52 localhost login: pam_unix(login:session): session opened for user jbc by LOGIN(uid=0)
May 31 12:58:52 localhost login: LOGIN ON tty1 BY jbc
May 31 13:02:01 localhost polkitd[659]: Registered Authentication Agent for unix-process:2581:22909 (system bus name :1.34 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
May 31 13:02:04 localhost polkitd[659]: Operator of unix-process:2581:22909 successfully authenticated as unix-user:root to gain TEMPORARY authorization for action org.freedesktop.systemd1.manage-units for system-bus-name::1.35 [init 5] (owned by unix-user:jbc)
May 31 13:02:05 localhost polkitd[659]: Unregistered Authentication Agent for unix-process:2581:22909 (system bus name :1.34, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
May 31 13:02:05 localhost login: pam_unix(login:session): session closed for user jbc
May 31 13:02:06 localhost gdm-launch-environment]: pam_unix(gdm-launch-environment:session): session opened for user gdm by (uid=0)
May 31 13:02:09 localhost polkitd[659]: Registered Authentication Agent for unix-session:c1 (system bus name :1.64 [gnome-shell --mode=gdm], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
May 31 13:02:15 localhost gdm-password]: pam_unix(gdm-password:session): session opened for user jbc by (unknown)(uid=0)
May 31 13:02:16 localhost gdm-launch-environment]: pam_unix(gdm-launch-environment:session): session closed for user gdm
May 31 13:02:16 localhost polkitd[659]: Unregistered Authentication Agent for unix-session:c1 (system bus name :1.64, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
May 31 13:02:17 localhost polkitd[659]: Registered Authentication Agent for unix-session:4 (system bus name :1.78 [/usr/libexec/xfce-polkit], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
May 31 13:02:33 localhost su: pam_unix(su-l:session): session opened for user root by jbc(uid=1000)
May 31 13:03:18 localhost polkitd[659]: Registered Authentication Agent for unix-process:4348:30623 (system bus name :1.87 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
May 31 13:03:18 localhost polkitd[659]: Unregistered Authentication Agent for unix-process:4348:30623 (system bus name :1.87, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)


Also, /var/log/secure ssh related:



[root@localhost ~]# cat /var/log/secure | grep "May 31" | grep ssh
May 31 00:58:03 localhost sshd[1141]: Server listening on 0.0.0.0 port 22.
May 31 00:58:03 localhost sshd[1141]: Server listening on :: port 22.
May 31 12:58:29 localhost sshd[1139]: Server listening on 0.0.0.0 port 22.
May 31 12:58:29 localhost sshd[1139]: Server listening on :: port 22.






centos ssh virtualbox sshd






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited May 31 '17 at 18:25

























asked May 31 '17 at 6:14









jbrock

282314




282314












  • what logs are in the server log (/var/log/secure)?
    – Jakuje
    May 31 '17 at 6:45










  • if SSH is correctly running, it'll likely be one of two things; 1) check that the server is listening over ssh with netstat -tulnp | grep 80 2) check firewalld isn't blocking traffic - you can quickly test by turning firewalld off: systemctl stop firewalld or just force open the port: firewall-cmd --zone=public --add-port=22/tcp --permanent
    – RobotJohnny
    May 31 '17 at 10:04












  • @RobotJohnny The debug output says that the ssh session successfully established a connection to the destination and on the correct port. That should rule out firewalld and SELinux port type ssh_port_t (which would have thrown permission denied errors if the new port wasn't added or a new type created)
    – Rabban
    May 31 '17 at 10:12










  • Try to increase the verbosity of your ssh connection by using the -vvv flag instead. That might provide additional clues. Apart from that, all we can do is speculate.
    – Rabban
    May 31 '17 at 10:13










  • @Rabban I had already tried -vvv which does not give us any additional information unfortunately.
    – jbrock
    May 31 '17 at 18:15


















  • what logs are in the server log (/var/log/secure)?
    – Jakuje
    May 31 '17 at 6:45










  • if SSH is correctly running, it'll likely be one of two things; 1) check that the server is listening over ssh with netstat -tulnp | grep 80 2) check firewalld isn't blocking traffic - you can quickly test by turning firewalld off: systemctl stop firewalld or just force open the port: firewall-cmd --zone=public --add-port=22/tcp --permanent
    – RobotJohnny
    May 31 '17 at 10:04












  • @RobotJohnny The debug output says that the ssh session successfully established a connection to the destination and on the correct port. That should rule out firewalld and SELinux port type ssh_port_t (which would have thrown permission denied errors if the new port wasn't added or a new type created)
    – Rabban
    May 31 '17 at 10:12










  • Try to increase the verbosity of your ssh connection by using the -vvv flag instead. That might provide additional clues. Apart from that, all we can do is speculate.
    – Rabban
    May 31 '17 at 10:13










  • @Rabban I had already tried -vvv which does not give us any additional information unfortunately.
    – jbrock
    May 31 '17 at 18:15
















what logs are in the server log (/var/log/secure)?
– Jakuje
May 31 '17 at 6:45




what logs are in the server log (/var/log/secure)?
– Jakuje
May 31 '17 at 6:45












if SSH is correctly running, it'll likely be one of two things; 1) check that the server is listening over ssh with netstat -tulnp | grep 80 2) check firewalld isn't blocking traffic - you can quickly test by turning firewalld off: systemctl stop firewalld or just force open the port: firewall-cmd --zone=public --add-port=22/tcp --permanent
– RobotJohnny
May 31 '17 at 10:04






if SSH is correctly running, it'll likely be one of two things; 1) check that the server is listening over ssh with netstat -tulnp | grep 80 2) check firewalld isn't blocking traffic - you can quickly test by turning firewalld off: systemctl stop firewalld or just force open the port: firewall-cmd --zone=public --add-port=22/tcp --permanent
– RobotJohnny
May 31 '17 at 10:04














@RobotJohnny The debug output says that the ssh session successfully established a connection to the destination and on the correct port. That should rule out firewalld and SELinux port type ssh_port_t (which would have thrown permission denied errors if the new port wasn't added or a new type created)
– Rabban
May 31 '17 at 10:12




@RobotJohnny The debug output says that the ssh session successfully established a connection to the destination and on the correct port. That should rule out firewalld and SELinux port type ssh_port_t (which would have thrown permission denied errors if the new port wasn't added or a new type created)
– Rabban
May 31 '17 at 10:12












Try to increase the verbosity of your ssh connection by using the -vvv flag instead. That might provide additional clues. Apart from that, all we can do is speculate.
– Rabban
May 31 '17 at 10:13




Try to increase the verbosity of your ssh connection by using the -vvv flag instead. That might provide additional clues. Apart from that, all we can do is speculate.
– Rabban
May 31 '17 at 10:13












@Rabban I had already tried -vvv which does not give us any additional information unfortunately.
– jbrock
May 31 '17 at 18:15




@Rabban I had already tried -vvv which does not give us any additional information unfortunately.
– jbrock
May 31 '17 at 18:15










2 Answers
2






active

oldest

votes

















up vote
0
down vote













Looks like key authentication is failing (do you have it set up?), and /etc/ssh/sshd_config may be missing the line:



PasswordAuthentication yes


Maybe include the /etc/ssh/sshd_config file from the CentOS VM for more information.






share|improve this answer




























    up vote
    0
    down vote













    You said:




    with a different Host Port (random high port number).




    but your log shows:




    Server listening on 0.0.0.0 port 22.




    When you attempt to log into the CentOS box, you get the response:




    OpenSSH_7.4p1 Debian-10, OpenSSL 1.0.2k 26 Jan 2017




    That's your Ubuntu box answering the call.



    It would have been even more obvious if you had included your /etc/ssh/sshd_config. The 'Port' setting there must match the high port you configure for forwarding.






    share|improve this answer





















    • thanks! Was struggling, and realized that port was used by another vm .. :)
      – Alex R
      Sep 21 '17 at 9:49











    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "106"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f368241%2fcannot-ssh-into-virtualbox-centos-7-guest-from-debian-host%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    Looks like key authentication is failing (do you have it set up?), and /etc/ssh/sshd_config may be missing the line:



    PasswordAuthentication yes


    Maybe include the /etc/ssh/sshd_config file from the CentOS VM for more information.






    share|improve this answer

























      up vote
      0
      down vote













      Looks like key authentication is failing (do you have it set up?), and /etc/ssh/sshd_config may be missing the line:



      PasswordAuthentication yes


      Maybe include the /etc/ssh/sshd_config file from the CentOS VM for more information.






      share|improve this answer























        up vote
        0
        down vote










        up vote
        0
        down vote









        Looks like key authentication is failing (do you have it set up?), and /etc/ssh/sshd_config may be missing the line:



        PasswordAuthentication yes


        Maybe include the /etc/ssh/sshd_config file from the CentOS VM for more information.






        share|improve this answer












        Looks like key authentication is failing (do you have it set up?), and /etc/ssh/sshd_config may be missing the line:



        PasswordAuthentication yes


        Maybe include the /etc/ssh/sshd_config file from the CentOS VM for more information.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered May 31 '17 at 19:43









        Deathgrip

        1,356311




        1,356311
























            up vote
            0
            down vote













            You said:




            with a different Host Port (random high port number).




            but your log shows:




            Server listening on 0.0.0.0 port 22.




            When you attempt to log into the CentOS box, you get the response:




            OpenSSH_7.4p1 Debian-10, OpenSSL 1.0.2k 26 Jan 2017




            That's your Ubuntu box answering the call.



            It would have been even more obvious if you had included your /etc/ssh/sshd_config. The 'Port' setting there must match the high port you configure for forwarding.






            share|improve this answer





















            • thanks! Was struggling, and realized that port was used by another vm .. :)
              – Alex R
              Sep 21 '17 at 9:49















            up vote
            0
            down vote













            You said:




            with a different Host Port (random high port number).




            but your log shows:




            Server listening on 0.0.0.0 port 22.




            When you attempt to log into the CentOS box, you get the response:




            OpenSSH_7.4p1 Debian-10, OpenSSL 1.0.2k 26 Jan 2017




            That's your Ubuntu box answering the call.



            It would have been even more obvious if you had included your /etc/ssh/sshd_config. The 'Port' setting there must match the high port you configure for forwarding.






            share|improve this answer





















            • thanks! Was struggling, and realized that port was used by another vm .. :)
              – Alex R
              Sep 21 '17 at 9:49













            up vote
            0
            down vote










            up vote
            0
            down vote









            You said:




            with a different Host Port (random high port number).




            but your log shows:




            Server listening on 0.0.0.0 port 22.




            When you attempt to log into the CentOS box, you get the response:




            OpenSSH_7.4p1 Debian-10, OpenSSL 1.0.2k 26 Jan 2017




            That's your Ubuntu box answering the call.



            It would have been even more obvious if you had included your /etc/ssh/sshd_config. The 'Port' setting there must match the high port you configure for forwarding.






            share|improve this answer












            You said:




            with a different Host Port (random high port number).




            but your log shows:




            Server listening on 0.0.0.0 port 22.




            When you attempt to log into the CentOS box, you get the response:




            OpenSSH_7.4p1 Debian-10, OpenSSL 1.0.2k 26 Jan 2017




            That's your Ubuntu box answering the call.



            It would have been even more obvious if you had included your /etc/ssh/sshd_config. The 'Port' setting there must match the high port you configure for forwarding.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered May 31 '17 at 20:59









            symcbean

            2,26911121




            2,26911121












            • thanks! Was struggling, and realized that port was used by another vm .. :)
              – Alex R
              Sep 21 '17 at 9:49


















            • thanks! Was struggling, and realized that port was used by another vm .. :)
              – Alex R
              Sep 21 '17 at 9:49
















            thanks! Was struggling, and realized that port was used by another vm .. :)
            – Alex R
            Sep 21 '17 at 9:49




            thanks! Was struggling, and realized that port was used by another vm .. :)
            – Alex R
            Sep 21 '17 at 9:49


















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f368241%2fcannot-ssh-into-virtualbox-centos-7-guest-from-debian-host%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Morgemoulin

            Scott Moir

            Souastre