SSH and Virtualbox and Windows

I’d like to know how you have, or would, set up SSH client and server on a Fedora/Linux VM running on Windows.

So far I’ve been able to connect directly to a separate computer running Fedora at home, from the VM and from putty, and have reached being given the password prompt. I haven’t been able to connect to the server on the VM without getting immediately refused. I’ve tried NAT and bridged for the VM port forwarding.

I’m learning all this stuff now, and thought I’d ask around for general tips on this. If you’d like more details about what I’ve done, such as logs, I’d be happy to provide em a little later.

On the VM you would need to enable the sshd service sudo systemctl enable sshd.service and start the daemon sudo systemctl start sshd.service.
You also would need to verify that ssh is allowed through the firewall. I use the gui firewalld-config which would also need installed. sudo dnf install firewalld-config I do not remember whether ssh is allowed to port 22 by default or not.

EDIT:
I just tested with my VM of F37 and as soon as I enabled the sshd on the vm I was able to connect from the host to that VM with ssh, so it seems the firewall allows that by default.

I do think that using nat will be a hindrance unless you have configured the host to allow port forwarding. I use bridged on the VM and connect it to the default virbr0 device on my fedora host. I also use libvirt and QEMU on my fedora host. Cannot speak to what would work with a windows host and using virtualbox with a fedora VM.

1 Like

I’m a little confused on what the end goal is. Is this correct?

You have a Windows computer on your LAN with a Virtual Box Fedora VM running on it. You want to connect to the Fedora VM via SSH from other devices on you LAN.

1 Like

@eddiejennings
Yes, that is correct. I’ve been looking to see how I might do that, and also how I might connect in the other direction, to other systems on my LAN from the Fedora VM.

Just to see how either might be done when a VM on windows is involved.

@computersavvy
Thank you, I believe all this should be in order, but I’ll look over it again as I’ve been trying various things and possibly messed something up. I did also manually configure selinux with regards to the ssh ports. I believe I have 22 and another port I want to use set up to be allowed to listen on the vm.

Without any idea with regards to what I might have done differently that’s new this time, I am now perfectly able to connect to and fro the VM.

Bridged. Custom port. No putty needed, though I managed to connect with putty on the Win host, as well.

Maybe I got the IP addresses confused before or summat.

Glad it’s worked out for you. For what it’s worth, you shouldn’t have to do any SELinux configuration for SSH unless you’re having sshd listen on a non-standard port.

It’s been a while since I’ve worked with Virtual Box, but when troubleshooting networking on it, you’ll probably find that it’s easier for your VM to reach out to things rather than things reaching into the VM.

One other thing to note, if you VM is Fedora Workstation, sshd is not enabled by default like it is on Fedora Server.

Thank you. I did change the port, so it’s good to know I did not mess about with selinux needlessly.