SSH

Can't ssh out : Fixing "Permission denied (publickey,password,keyboard-interactive)."

Suppose you're on a relatively secure Linux box and receive the following message when trying to ssh out interactively (no keys) :

- Permission denied (publickey,password,keyboard-interactive).

Here's one possible solution :

Check the /etc/ssh/ssh_config (client ssh) file and see if it contains this :

- PasswordAuthentication no

If so, change it to the following :

- PasswordAuthentication yes

Now try your interactive ssh session -- you shouldn't need to restart a service or anything else.

Categories: 

Preventing SSH timeouts

Depending on the environment you're working in, you may be automatically logged out from a server by SSH timeouts. Here are a few things you can do to help prevent these timeouts :

Add or modify the following in your /etc/ssh/sshd_config file :

ClientAliveInterval 28800
ClientAliveCountMax 28800

In your ~/.bashrc file, set the TMOUT parameter to something longer. For example :

export TMOUT=28800

On your client (PuTTY) set the seconds between keepalives to something like 30.

How to set up PuTTY SSH keys

1. Start up PuTTYgen.exe. The defaults of SSH-2 RSA and 1024 bit key should be fine.

2. Click Generate to make the key (moving mouse randomly over blank area).

3. Fill in the comment (me at example.com). Enter a passphrase. A passphrase is more secure, but you'll be prompted for it on every access (unless you use keychain or others).

4. Use PuTTYGen's button to save the public key on your PC (ex. c:\putty\keys\me-at-example.txt).

5. Use button to save the private key. You must use .ppk extension (ex. c:\putty\keys\me-at-example.ppk).

Categories: 

SSH keys, PuTTY, Keychain etc. resources

Here are some good resources in the area of SSH keys :

## Key-based logins with PuTTY - Excellent How-To with pics

* http://www.howtoforge.com/ssh_key_based_logins_putty

## Good overview of SSH keys - including optional hardeners

* http://www.eng.cam.ac.uk/help/jpmg/ssh/authorized_keys_howto.html

## Good overview of SSH keys, including Keychain to remember passphrases

* http://www.ibm.com/developerworks/linux/library/l-keyc.html
* http://www.gentoo.org/proj/en/keychain/

Note PuTTY's Pageant is a Windows form of Keychain

Categories: 
Subscribe to RSS - SSH