NerdZ 4 Ever
3971218 | guest | V2.62

Search :     Cat.   order 

Automatic login using SSH

v4| by a3 on 2007-09-12 13:20:07    (6412) rating

If you want to automate logging in over SSH (for instance to schedule file transfer) you need to exchange DSA or RSA keys, coz there's no one to type a password.

While there's plenty of documentation available I still had some problems (funny how my situation always seems to be different from everybody else ;-)

To test the auto-login I used WinSCP - one of the most popular clients for Windows.

You can generate keys on Unix but if you transfer the key files to Windows, WinSCP doesn't know what to do with them.

And on Windows you can generate keys using PuttyGen (select DSA or RSA encryption)
On Debian the public key file should be stored in ~user/.ssh/authorized_keys (specified in sshd_config - check to make sure) but the PuttyGen DSA public key file is in a format Unix (Debian) doesn't like - which I found out by checking SSHDs messages in /var/log/auth.log

You can fix that file by editing the file (authorized_keys) and removing everything but the key itself and putting 'ssh-dss ' in front of it (including a whitespace) and a whitespace on the end.

So here are some tips :

  • 1st : read 'Password-less logins with OpenSSH'-
  • check the SSHD config file /etc/sshd/sshd_config as described (not /etc/sshd/ssh_config)
  • set the logging to Maximum to find out what the problem is : LogLevel DEBUG3
  • check the permissions of ~user/.ssh/ (if incorrect you will see messages in the log)
  • or switch off directory permissions checking : StrictModes no (switch back on later)
  • restart SSHD : /etc/init.d/ssh restart
  • check /var/log/auth.log

Some links :

SSHD man page :

WinSCP - Using Public Key authorisation :
only registered users can view responses

Other articles in Development

Construct 22015-02-24a3
Adobe cancels Flash on iPhone (and iPad)2010-04-21a3
Scratch - Imagine, program , share2009-10-31a3
Eenvoudig gebruik maken van .NET Cultureinfo & LINQ naar een combobox2009-06-18enierop
Dr Dobbs challenge2009-03-03a3
Firefox Throttle2009-01-19Rachid
trailing slash ?2008-11-27Rachid
WMI Administrative Tools2008-11-20Rachid
Toetsenborden afluisteren2008-10-21Rachid
Complete websites te koop2008-10-13Rachid
SQLite Manager2008-07-16Rachid
Jonge uitvinders2008-05-25Rachid
Crowdsourcing met Cambrian House2008-05-21Rachid
Dates in PHP and MySQL2008-03-10Rachid
Google coding rules of engagement2008-03-03r g
Flash Photo Stack2008-02-19Rachid
Hot or not voor echte nerds2008-02-08eric
De performance van een overheids website, DenHaag.nl2008-01-25enierop