Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using key based authentication for ssh. When ever i try to login into the system it doesn't ask me for public key. It simply logs in, i just want to logout from this public key authentication. And when ever i need i will enable it. Can some one say me the way to logout from Public Key authentication. And How to set timeout for this public key authentication? Thanks in advance.

share|improve this question
up vote 4 down vote accepted

If from command line you can see your identity with

ssh-add -l

then you can remove it (i.e. make the agent to forget it), with

ssh-add -D
share|improve this answer
Is it possible to set a automatic timeout? – karthick87 Dec 8 '11 at 8:32
@karthick87: you can use ssh-add -t number-of-secs. It will ask for passphrase. – enzotib Dec 8 '11 at 8:43
What is the default timeout? – karthick87 Dec 8 '11 at 9:42
There is not timeout (or infinite timeout). The man page of ssh-add say it is configurable, but cannot found where. – enzotib Dec 8 '11 at 9:51
For the traditional ssh-agent, it is possible to set a default time out through a command line switch. You'll probably find that ssh-add is talking to gnome-keyring though, and I don't think it has the facility to set a default time out for keys. – James Henstridge Dec 8 '11 at 10:25

Do you mean you want a normal login/logout method? If yes, then remove the key in the remote machine. I think its in /home/$USER/.ssh/authorized_keys then restart ssh daemon. Please let me know if that is correct.

share|improve this answer
No you are wrong. I just want to logout from the public authentication. So that after i close my terminal and if i open again, it should prompt for public key. – karthick87 Dec 8 '11 at 7:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.