How to automatically add your ssh public key to authorized_keys files?

I'm looking for the simplest set of commands that you can run to add a public key to the authorized_keys files of the root account on a remote server.

We assume that the current user has access to the remote server, and he is also listed in the sudoers file.

Running a command twice should have no effect.

+4
source share
1 answer

How to run ssh-copy-id command? Human pages say the following:

ssh-copy-id - set your public key on the remote computer authorized_keys

What exactly are you looking for? However, I never tried to run the command twice. He cannot verify this.

+7
source

Source: https://habr.com/ru/post/1412514/


All Articles