I tried to set up a ssh key for easily logging into the server which is hosting my website : ssh-keygen -t dsa -b 1024
.
The keys (public and private) have been saved in /var/root/.ssh
which I dont like because I have to sudo -s
prior to rsync for accessing the private key.
Is there any easy and safe way to move the ssh folder from /var/root/.ssh
to my user folder, so that I can use the keys even if not root ? what location to move it ? what is the command for newbie to be used for the relocation ? (for mac os 10.10)
Thank you.
Best Answer
If you've simply created a DSA key as root, it would be safest to do the following (from a terminal as your own user):
This will create a
.ssh
configuration directory in your homedir (mkdir -p
won't make loud noises if~.ssh
already exists, and won't do anything), copy the public and private key files fromroot
's homedir to your own, then set the correct permissions and ownership on your files.This is non-destructive (you're not moving anything, you're just copying); once you're happy the key-pair is letting you connect to your remote host successfully as your normal login user, you can
sudo rm -fv /var/root/.ssh/id_dsa /var/root/.ssh/id_dsa.pub
This also doesn't affect any other files in either account's.ssh
folder.