Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ssh key stops functioning after a while

Tags:

git

ssh

ssh-keys

I was using git on a remote server (Ubuntu 14.04 LTS). It works smoothly, until a certain amount of time passed by. I was denied access to the repository (no this issue on my local machine). How does this happen? And is there anyway to solve it?

like image 852
Qiaosen Huang Avatar asked Oct 01 '15 14:10

Qiaosen Huang


People also ask

Why did my SSH key stop working?

Make sure the authorized_keys file and the private key itself have the correct permissions and ownership. Check that key-based authentication is allowed by the server. Make sure the private key is readable by the SSH client. If you're using PuTTY, make sure your SSH keys are properly configured for the session.

How long does an SSH key last?

Traditional SSH keys have no expiry; in fact they have no metadata whatsoever (except maybe a comment field).

Do GitHub SSH keys expire?

As a security precaution, GitHub automatically deletes SSH keys that haven't been used in a year.

How do you tell if an SSH key has expired?

SSH keys do not have expiration dates. Rotation of keys is up to your internal process. PGP keys and SSL certificates have expiration dates built-in as part of their public specifications.


1 Answers

First, an ssh key does not "expire" (ssl certificates do, but that is another topic). They are revoked (removed from the .authorized_keys on the remote side)

(Update August 2019: as shown in "SSH certificate authentication for GitHub Enterprise Cloud", SSH allows one SSH key (a certificate authority) to sign another SSH key, along with information about the developer it belongs to. And that include an expiration date)

Second, if it was working and no longer work, something must have changed, like the $HOME value (since ssh looks for a public/private key in $HOME/.ssh)

If is possible that the process using ssh does not run with the usual account, but with another user (or with root if preceded by sudo)

like image 87
VonC Avatar answered Sep 27 '22 19:09

VonC