Linux is usually installed on servers or virtual machines (VMS), so remote access, file transfer, and remote desktop services must be configured.Copy the code

The article directories

  • 1. Premise – Check whether the two parties can ping through each other
    • 1.1. View the IP address of the Linux host
    • 1.2. On the Cli of Windows, ping is used
  • 2. Remote access — SSH
    • 2.1. Check the SSH service status
    • 2.2. Install the SSH server on Linux hosts
    • 2.3.Windows hosts use the SSH client
    • 2.4.Xshell display optimization
      • 2.4.1. The terminal has a color prompt
      • 2.4.2. Terminal copy-paste optimization
  • 3. Remote file transfer – WinScp based on SSH
  • 4. Remote desktop — vnc4Server +gnome2
    • 4.1. Install the VNC server
    • 4.2. Install gnome2
    • 4.3. Modify the configuration
    • 4.4. Use the VNC client for access

1. Premise – Check whether the two parties can ping through each other

1.1. View the IP address of the Linux host

useifconfigCommand to seeLinux host IP address:

1.2. On the Cli of Windows, ping is used

Used in Windowswin+rOpen run and typecmdGo to the command line and usePing + <Linux host IP address >Test whether the ping succeeds:

Ping successful, proceed to the next work.

2. Remote access — SSH

SSH, short for Secure Shell, is an encrypted network transmission protocol. It is usually used to remotely log in to the system and transmit the command line interface (CLI). It is designed as a substitute for Telnet and insecure Shell (plaintext transmission, easy to be monitored). SSH uses the client-server model. The server needs to enable the SSH daemon (port 22 by default) to accept remote connections, and the user uses the SSH client to establish connections with the server. By far the most popular SSH implementation is OpenSSH, which is available on most operating systems.

2.1. Check the SSH service status

usesshd statusCheck the current Linux host service status:

2.2. Install the SSH server on Linux hosts

Run the OpenSSH command to set up the SSH server on a Linux hostsudo apt-get install openssh-server:

After the installation, check the SSH service status again.

2.3.Windows hosts use the SSH client

A good SSH client for Windows is Putty and Xshell. I use Xshell here. Linux host IP address:

  • To view the IP address:ifconfig

Use the command in Xshell:SSH < username >@< IP address >Login, the first login will pop up whether to save the key, selectAccept and save:

Enter the Linux user password:

Login successful:

2.4.Xshell display optimization

2.4.1. The terminal has a color prompt

Input at terminalvi .bashrcOpen the file and find#force_color_prompt=yesThis row, get rid of the front#To re-log in:

2.4.2. Terminal copy-paste optimization

Open it in XshellTools -> Options -> Keyboard and mouse:

3. Remote file transfer – WinScp based on SSH

After the SSH service is enabled on a Linux hostIn Windows, you can use WinScp to upload and download files between Linux. WinScp is an open source GRAPHICAL SFTP client based on SSH and supports the SCP protocol.

Open WinScp and selectThe new siteEnter the IP address of the Linux host name:

Fill in the blanks and choosesave, next time you can easily enter:

Then double-click to enter:

Drag back and forth between the two hosts to facilitate the transfer of files, it is not too easy to use ~

4. Remote desktop — vnc4Server +gnome2

4.1. Install the VNC server

Here we use vnc4Server, the default port is 5900, and each additional user adds 1 to the port.

usesudo apt-get install vnc4serverInstallation:

4.2. Install gnome2

Use the following command to install:

sudo apt-get install --no-install-recommends ubuntu-desktop gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal -y

4.3. Modify the configuration

Start the VNC servicevncserver :1, set the password:

Then shut down the VNC servicevncserver -kill :1:

Run the sudo vim ~/. VNC /xstartup command to open a configuration file, and then add four lines to the end:

gnome-panel & 
gnome-settings-daemon & 
metacity & 
nautilus &
Copy the code

Restart the VNC service:

4.4. Use the VNC client for access

The client uses VNCviewer, start VNCviewer, and enter<Linux host IP >:< port >The default port is 5900, so the port should be 5901 as user 1:

Connection successful: