ubuntu20 for network configuration and sftp connection

1. Select the connection method

2. Install openssh-server

sudo apt install openssh-server

 

3. Modify

sudo gedit /etc/ssh/sshd_config

 join here

 

PermitRootLogin yes

4. IP settings

Open cmd to view the ip information of the current host through ipconfg

Set Ubuntu's netplan configuration file according to the host's configuration information

sudo gedit /etc/netplan/01-network-manager-all.yaml

 

network:
  ethernets:
    enp0s3:  # 网卡名
      dhcp4: false  # 设置为静态,如果动态改为true,下面的参数都不需要设置了
      addresses: [192.168.43.182/24]  # 地址和子网掩码,注意地址段应该与宿主机一致
      gateway4: 192.168.43.1  # 默认网关,与宿主机一致
      nameservers:
          addresses: [8.8.8.8,114.114.114.114]  # DNS
  version: 2 

I use dynamic here

 After the modification is completed, it is necessary to

sudo netplan apply

 5. Query ip

ifconfig

 6. Check whether the virtual machine and the host can ping each other

7. Try sftp connection

Select a connection software, select SFTP, enter the IP of the virtual machine, enter the registered name for the user name, and enter the password. 

connection succeeded

 

 

Guess you like

Origin blog.csdn.net/zis0926/article/details/130134824