Windows Ubuntu subsystem ssh and ftp

Generally speaking, for Linux servers, we will use ssh and ftp to interact, usually xshell and xftp two software.

But many times, we may not have a Linux server. At this time, our personal computer can barely become a Linux server:

If you want to interact with the Ubuntu subsystem of your windows, you must first know the IP address of the Ubuntu subsystem of windows.

IP address to check first

Because the Ubuntu subsystem of Windows that we opened is actually a window that can execute linux commands of Windows10, it is the same ip address. Use sudo to download and install two toolkits in the terminal of the Ubuntu subsystem:

sudo apt install  net-tools
sudo apt-get install openssh-server

Then use the ifconfig command to view in Ubuntu, as follows:

jmzeng@DESKTOP-D7COBEK:~$ ifconfig
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 1500
  inet 127.0.0.1  netmask 255.0.0.0

wifi0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
  inet 192.168.0.108  netmask 255.255.255.0  broadcast 192.168.0.255

Use ipconfig to view on windows computer

 IPv4 address............:192.168.0.108
 Subnet mask............:255.255.255.0
 Default gateway.............:192.168.0.1

If you are using your own windows computer to connect to its internal Ubuntu subsystem, then use 127.0.0.1. If you are using other computers under the same router as your windows computer to ssh to connect to it, use this windows The intranet IP of the computer is fine.

Modify the port of the Windows Ubuntu subsystem SSH protocol

Because the 22 port of windows itself is occupied, it is necessary to modify the port of the SSH protocol of the Ubuntu subsystem of windows. I refer to the configuration code of https://www.jianshu.com/p/bc38ed12da1d/ here:

# 1. Install ssh(Generally not needed,Have been installed before)
sudo apt-get install openssh-server
# 2. Modify the configuration file
sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak
sudo vim /etc/ssh/sshd_config
#=======( Modify the following options)=========#
Port 222
AddressFamily any
ListenAddress 0.0.0.0 
PasswordAuthentication yes
#================================#
# 3. Start ssh
sudo service ssh restart
# 4. If it prompts &quot;sshd error:could not load host key&quot;, then use the following command to regenerate
rm /etc/ssh/ssh*key
dpkg-reconfigure openssh-server

Then you can easily use the xshell software to connect to it. Because you are connecting to yourself, you can use the IP 127.0.0.1, which represents the localhost computer, which is your own computer. The settings are as follows:

However, generally speaking, your own windows computer does not need to connect to the Ubuntu subsystem of your own windows, because you can log in to the terminal directly. After successful connection as follows:

Most likely, other working computers on the same router will connect to it, so use the internal IP of 192.168.0.108.

Recommended Posts

Windows Ubuntu subsystem ssh and ftp
Windows 10 install Linux subsystem Ubuntu
Redis installation under ubuntu and windows
[Daily] Win10 open and install ubuntu subsystem
Installation and use of Win10 subsystem Ubuntu
Windows 10 subsystem linux install pagoda panel Ubuntu
Ubuntu install ftp server and possible problems
Use Ubuntu and windows system in virtual machine
Technical corner | Windows 10/7 and Ubuntu 18.04 dual system installation
Installing CentOS 6 and SSH configuration under Windows 8 Hyper-V
Installation and use of SSH in Ubuntu environment
Summary: Ubuntu Python2.x and
About win10 subsystem (ubuntu)
Ubuntu20.04 experience and beautification
Ubuntu introduction and installation
[python] python2 and python3 under ubuntu
Install the Ethereum client Mist on windows and ubuntu
Ubuntu ssh Android phone
Ubuntu12 step-by-step installation and configuration (system, FTP, TELNET.. settings)
Ubuntu backup and restore
Ubuntu opens SSH service for remote login and file transfer
Method steps for installing and configuring SSH service under Ubuntu 18.04
Deploy FTP server under ubuntu
ubuntu16.04 build vim and pyt
ubuntu18.04 compile and install python3.8
Open SSH service under Ubuntu
Ubuntu16.04 installation and simple configuration
ubuntu 16.10 supports ssh remote access
Jmeter (18)_Ubuntu deploy jmeter and ant
Open SSH service under Ubuntu
Ubuntu16.04 install SVN and configuration
Ubuntu16.04 install and uninstall VMware-Workstation 14
Ubuntu PostgreSQL installation and configuration
Detailed explanation of the installation and use of SSH in the Ubuntu environment
How to realize file sharing between Ubuntu and Windows under VMware