Move .ssh folder from /var/root/ 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.
Open Terminal while logged in as your usual user, then run

mkdir ~/.ssh
sudo sh -c 'mv /var/root/.ssh/* /Users/'$USER'/.ssh/'
sudo chown $USER ~/.ssh/*
sudo chgrp $(groups | cut -d \  -f 1) ~/.ssh/*
chmod 700 ~/.ssh
chmod 600 ~/.ssh/*


This assumes that you haven't created any ssh key pairs as your usual used (and therefore don't already have files in ~/.ssh).

PS: Some explanations:


First sudo moves the content of root's .ssh folder into the one of the current user. Needs to be done by calling a subshell (sh -c) because the wildcard part (/var/root/.ssh/*) only works after the sudo has changed the current user to root. $USER is an environment variable containing the name of the current user
Third sudo changes group ownership of the copied files to the primary group of the current user. As there is no convenient environment variable for this, the output of groups (which lists all groups a user belongs to) needs to used. Please note the two space characters after the \.