Lets say that to login to a remote address instead of a ssh login and password I have received rsa private and public keys. Is it safe to use it and how should I add them to the .ssh folder? manually appending the id_rsa files? I have only the authorized_keys there
closed as too broad by Ramhound, Pimp Juice IT, Twisty Impersonator, Kamil Maciorowski, Dave M Oct 5 '17 at 15:35
Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
Ssh private and public keys (asymmetric keys) works like that:
the private key should be only known (ie. stored) in a secure manner (eg. encrypted) in your client (local) machine. The default location for ssh keys are
$HOME/.ssh/id_rsa. However you can have several keys stored in your local machine (eg.
$HOME/.ssh/id_rsa_myotherkeypair). In that case you can tell ssh that you want use another key than the default by specifying the option
ssh -i $HOME/.ssh/id_rsa_myotherkeypair USER@REMOTESERVER
id_rsa*file shall by no mean contain multiple keys
the public key should be stored with your private key (unencrypted) in order not to lose it. It also must be advertised to your remote server (ie. associated with your user). There is several ways to achieve that:
append the content of the
$HOME/.ssh/authorized_keysof your remote server.
execute the command
ssh-copy-idon your local machine, that will do it for you :
ssh-copy-id -i $HOME/.ssh/id_rsa_myotherkeypair USER@REMOTESERVER