ssh-copy-id
时间: 2023-10-16 19:10:20 浏览: 36
SSH-copy-id is a command-line utility that helps to copy a user's public SSH key to a remote server's authorized_keys file. This allows the user to authenticate to the remote server without being prompted for a password each time.
The syntax for using ssh-copy-id is as follows:
ssh-copy-id [options] [user@]hostname
Some of the important options are:
-i: Use a specific identity file instead of the default ~/.ssh/id_rsa.pub
-p: Specify a non-standard port number for the SSH connection
-f: Overwrite any existing keys in the remote server's authorized_keys file
For example, to copy your public SSH key to a remote server with the hostname "example.com" and username "john", you would run the following command:
ssh-copy-id john@example.com
You will be prompted for the password for the remote server's user account. Once you enter the correct password, your public SSH key will be copied to the remote server's authorized_keys file, and you will be able to log in without a password in the future.