OpenSSH of linux_

Abstract: 1. Introduction OpenSSH is an implementation of a set of SSH communication protocols that realizes remote connection to the host and realizes the remote operation of the host, based on the CS architecture. The client on Linux has ssh scp sftp The Linux server program is sshd 2. The configuration file client configuration file is in /etc/ssh/ssh_config The server configuration file is in /etc/ssh/sshd_config 3. ssh uses the format ssh [userId @]host ["COMMAND"] [userId@] It can be omitted when using ssh on Linux. If omitted, the user who logs in to the current system is used as the userId to request a connection to the remote host by default.

1. Introduction
OpenSSH is an implementation of a set of SSH communication protocols that realizes remote connection to the host and realizes the remote operation of the host, based on the CS architecture.
The client on Linux has ssh scp sftp
The Linux server program is sshd
2. Configuration file The
client configuration file is in /etc/ssh/ssh_config The
server configuration file is in /etc/ssh/sshd_config
3. ssh uses the
format ssh [userId @]host ["COMMAND"]

[userId@] It can be omitted when using ssh on Linux. If omitted, the user who logs in to the current system is used as the userId to request a connection to the remote host by default.
[command] allows the user to only connect to execute commands similar to using su - userId -c COMMAND

Other parameters:
-l userId indicates the user to connect, equivalent to [userId@]
-p port indicates the port number of ssh connecting to the remote server, the default is 22
4. SSH login based on secret key
Principle : Generate a pair of public key and secret key locally on the ssh client, and upload the public key to the remote server to be connected. In a user's home directory, when connecting to a remote host through ssh host, there is no need to enter a user name and password, and authentication is performed through a public key and a secret key.

Specific implementation:
1. Generate the key pair
ssh-keygen -t rsa
-t specify the encryption type
Enter the path of the specified output file, if not written, the default is the .ssh folder in the current user's home directory, the encryption operation can set a password, It is used for decryption and generates two files, an id_rsa and id_rsa_pub public keys, which are in the .ssh directory by default.
2. Upload the public key to the user's home directory corresponding to the remote server.
Specify ssh_copy_id -i file [userId@]host
-i The public key file to be uploaded
For example ````
ssh_copy_id -i ~/.ssh/id_rsa_pub [email protected]

After uploading, there is a .ssh folder under the root of the remote host, and one of the authorized_keys is the public key. Next time the client ssh No need to enter user password when connecting

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326222248&siteId=291194637