Ssh is mainly used for remote management of linux. It transmits data encrypted and can be logged on to the remote computer as the root user. Assume that the server ssh service is enabled (enabled by default) and how to connect the client to a remote server. This example uses the following environment:
Ssh [user @] hostname [command]
> [User @]: user Name of the remote computer
> [Command]: The command directly executed after the connection is successful
> Sometimes, when you do not connect to the server through ssh, you can ~ /. Delete the content in ssh and try again.
Scp [user @] host:/path [-rpC]
> File copying between the ssh client and the server
>-R: Recursion
>-P: Retain the original file permission.
>-C: compressed data during transmission
> Rsync srcfile host:/path
To synchronize files between the client and the server, this command is one-time. If you need to regularly execute the command, you need to use the scheduled task. During synchronization, only srcfile TO host:/path
You need to enter the password of the remote computer every time you connect to the remote computer using ssh, which may be troublesome. You can use a key file to generate a key file on the local machine and copy the public key file to the remote computer again. You do not need to enter a password when you connect the private key file to the remote computer on the local machine.
> Of course, to ensure security, you can set a password for the private key file when generating the key pair. The password entered when you connect to the remote computer is the password of the private key file, rather than the user password of the remote computer. Of course, to facilitate saving the password of the private key file on a computer, you do not need to enter any password when connecting to a remote computer, however, if the private key file is copied to another computer, you still need to enter the password of the private key file. The configuration steps are as follows:
> Generate a key pair File
Copy the public key to a remote computer
Connect to the server again
Save the private key file to the Local Machine