1

I am using Ubuntu 22.04. This is an unusual question since most users want to make the ssh agent remember the password once it is entered per user session. I would like it to ask for the password every time I am using ssh (mostly for git pull and push purposes). I have tried to set

Host *
     AddKeysToAgent no

to my ~/.ssh/config file. I have checked that the .bashrc is not storing the password in an environment variable. Can anyone please help me make ssh ask for the passphrase every time?

Thank you.

1 Answer 1

-1

Try the following:

Open a terminal.

Edit the SSH configuration file.

 sudo nano /etc/ssh/sshd_config

Find the line containing the PasswordAuthentication directive in the sshd_config file, make sure the line is the following:

 PasswordAuthentication yes

Save your changes and close the text editor, pressing Ctrl+O to save and then Ctrl+X to exit.

Restart the SSH service for the changes to take effect:

  sudo service ssh restart

Now, every time you connect to an SSH server from your system it should ask for the password of the remote user you are trying to access.

1
  • This didn't work :( I even rebooted after making these changes. Any given repo asks for the password once, and then not again. Commented Sep 29, 2023 at 14:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .