Install Ubuntu as a Virtual Guest in VirtualBox and Connect to ssh from a Windows 10 Host

Asked 1 years ago, Updated 1 years ago, 275 views


Installed Ubuntu 20.04.2 LTS as Virtual Guest in VirtualBox 6.1.16 Guest has no ssh connection from Windows 10 Home 20H2.

Question details

You are trying to define a Unit configuration file for ssh in systemd.
I think the file is misplaced, but I'm worried about what's wrong.

I tried 、 and を below, but it doesn't work.
①Initially, we placed sshd.service as the Unit configuration file below.
/etc/systemd/system

However
$ systemctl start sshd.service
and
Failed to start sshd.service:Unitsshd.service is masked.
will be

$systemctl unmask sshd.service
is removed when you run , and the Unit file is /etc/systemd/system
Removed from the .

次 Next, /usr/lib/systemd/system
Place the sshd.service file in the directory and
/etc/systemd/system
I copied it below.

Still, like と, if you execute the sshd start command, it becomes masked.
Unmask will delete the configuration file.

What you did before

You have already configured the host-only bridge adapter in VirtualBox.

We also added a configuration to allow SSH to ssh_config.
Add the following configuration to the end of /etc/ssh/ssh_config

Port 22
PermitRootLogin no
PasswordAuthentication yes

That's all.We would appreciate it if you could provide us with information.

linux ubuntu ssh virtualbox

2022-09-30 21:54

1 Answers

Simply do the following to connect.

 apt-y install openssh-server
systemctl restart ssh

/You should modify /etc/ssh/sshd_config to prevent root login.

Connect ssh to the network address IP of the host only adapter.
N The network address IP of the NAT network could not connect to ssh.
ブリッジI have never used a bridge to join the host OS network.

[Additional note]
My environment is manually configuring IP for VMs.ホスト Specify the IP that belongs to the network address of the host only adapter

Since the host OS IP is a different network address, we are routing it as follows:

 route add-p network address of host only adapter / 24 host only adapter IP

After removing the routing as a trial, the ssh connection from the host is no longer possible, so I would like to supplement it.


2022-09-30 21:54

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.