5. Remote operation
5.1 introduction to SSH
SSH is the abbreviation of secure shell, which is developed by the network working group of IETF; SSH is a security protocol based on application layer and transport layer.
SSH is a reliable protocol that provides security for remote login sessions and other network services.It is often used for remote login and data copying between users。
Using SSH protocol can effectively prevent information disclosure in the process of remote management. SSH was originally a program on UNIX system, and then quickly extended to other operating platforms. SSH can make up for loopholes in the network when used correctly. SSH client is applicable to a variety of platforms. SSH can be run on almost all UNIX platforms including HP-UX, Linux, AIX, Solaris, digital UNIX, IRIX, and others.
To use SSH service, you need to install the corresponding server and client.Relationship between client and server:If machine a wants to be remotely controlled by machine B, machine a needs to install ssh server and machine B needs to install SSH client.
5.2 remote login
5.2.1 Linux platforms are remote from each other
Operation command: SSH – L username hostip
Note: the two remote login machines must be able to Ping.
First, check the IP address of the remote machine to be:
Remote login (here is user Wencong (machine a) and remote login edu (machine B)), sudo is not required:
SSH tells the user that this host cannot be recognized. At this time, type “yes” and SSH will write the relevant information into “~ /. SSH / know_hosts”. If you visit again, there will be no such information. After entering the password, you can log in to the host.
Next, prompt for the login password:
5.2.2 windows remote login Linux
If you want to log in to Linux remotely on Windows platform, windows needs to install the corresponding software package. This is xmanager.
Xmanager is a small and convenient tool for browsing the remote X window system. It includes xshell, xftp and other software:
Xshell: SSH, telnet and rlogin terminal software under Windows platform. It enables users to easily and safely access UNIX / Linux hosts on the windows platform.
Xftp: an FTP and SFTP file transfer program applied to Windows platform. Xftp can safely transfer files between UNIX / Linux and windows platforms.
Configure xshell, remote login:
The default encoding format adopted by Linux is UTF-8, and the default encoding format adopted by windows is ANSI (GB2312, GBK), so the following corresponding codes need to be set:
5.3 remote file transfer
5.3.1 Linux platform mutual transmission
SSH provides some commands and shells to log in to the remote server. By default, users are not allowed to copy files, but a “SCP” command is provided.
Copy local files to remote:
scp FileName [email protected]:RemoteFile
scp FileName RemoteHostIp:RemoteFolder
scp FileName RemoteHostIp:RemoteFile
Copy local directory to remote directory:
scp -r FolderName [email protected]:RemoteFolder
scp -r FolderName RemoteHostIp:RemoteFolder
Copy remote files to local:
scp [email protected]:RemoteFile FileName
scp RemoteHostIp:RemoteFolder FileName
scp RemoteHostIp:RemoteFile FileName
Copy remote directory to local:
scp -r [email protected]:RemoteFolder FolderName
scp -r RemoteHostIp:RemoteFolder FolderName
Copy remote files:
The name of a remote file can be changed at will:
You can specify the storage path for copying remote files:
5.3.2 transferring files between windows and Linux
Xftp provided with xmanager is an FTP and SFTP file transfer program applied to Windows platform. Xftp can safely transfer files between UNIX / Linux and windows platforms.