Quantcast
Channel: SSH ids are forgotten on logout - Ask Ubuntu
Viewing all articles
Browse latest Browse all 3

Answer by David Edwards for SSH ids are forgotten on logout

$
0
0

When you are logged in as root (in your verbose output above it shows that you are) and you run ssh, it will look for keys in root's .ssh directory; not the directory of the user specified in the ssh connection string.

I am not entirely sure why you are running any of this using sudo; when you create and copy your keys you need to be logged in as the user you are intending to use for ssh.

I am a bit confused by your description of what you did, but as a first step I suggest you make sure that you have created the key in the correct user's .ssh directory and that when you are running ssh you are running it as the correct user to pick up that key file.

The second part of your question is about using ssh-agent to store your key's passphrase. There is a good guide to doing this here: http://www.akadia.com/services/ssh_agent.html. Again, you need to be running ssh-agent (on the client, if that isn't clear) as the correct user. Note that ssh-agent only stores the passphrase in memory, so if it is terminated and you start a new ssh-agent process it will no longer remember your passphrase. On a server, this is not such as issue; you just need to start up the agent once and keep it running in the background. There are details in the link above explaining how to tell your script where to find the agent by storing the location of the agent socket in a temporary file that your backup script can read.


Viewing all articles
Browse latest Browse all 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>