Question
A systems administrator is configuring new Linux systems and needs to enable passwordless authentication between two of the servers. Which of the following commands should the administrator use?
- A. ssh-keygen -t rsa && ssh-copy-id -i ~/.ssh/id_rsa.pub john@server2 Correct
- B. ssh-keyscan -t rsa && ssh-copy-id john@server2 -i ~/.ssh/key
- C. ssh-agent -i rsa && ssh-copy-id ~/.ssh/key john@server2
- D. ssh-add -t rsa && scp -rp ~/.ssh john@server2
Explanation
ssh-keygen -t rsa creates an RSA key pair, and ssh-copy-id -i ~/.ssh/id_rsa.pub installs the public key in john's authorized_keys on server2, so later logins use the key instead of a password. ssh-keyscan only collects host keys from servers and does not create a user key. ssh-agent and ssh-add manage keys that are already loaded, and copying the whole ~/.ssh folder with scp would expose the private key without setting up authorized_keys properly.