You are not logged in.

#1 2010-07-15 05:48:55

supulton
Member
Registered: 2008-12-31
Posts: 58

[SOLVED] putty doesn't use a keyfile?

I'm trying to set up a connection between a windows machine with putty and an arch linux box with ssh. I've read through the ssh wiki and Using SSH Keys (generating and the putty section) but I can't seem to get putty to use the keys. I'm suspecting it's a configuration issue. When I connect to my machine from putty, it asks merely for my username and password; this seems rather insecure considering I've generated a dsa key pair with a password to connect to ssh sessions. I've also converted it to a putty format key, but when I connect from putty, it does not seem to matter whether or not I use the key--it still asks for my username and password on my arch linux box. I've also added my public key to ~/authorized_keys on my arch box.

Here's my /etc/ssh_config

Host *
#   ForwardAgent no
#   ForwardX11 no
#   RhostsRSAAuthentication no
#   RSAAuthentication yes
#   PasswordAuthentication yes
#   HostbasedAuthentication no
#   GSSAPIAuthentication no
#   GSSAPIDelegateCredentials no
#   BatchMode no
#   CheckHostIP yes
#   AddressFamily any
#   ConnectTimeout 0
#   StrictHostKeyChecking ask
#   IdentityFile ~/.ssh/identity
#   IdentityFile ~/.ssh/id_rsa
#   IdentityFile ~/.ssh/id_dsa
#   Port 22
Protocol 2
#   Cipher 3des
#   Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc
#   MACs hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160
#   EscapeChar ~
#   Tunnel no
#   TunnelDevice any:any
#   PermitLocalCommand no
#   VisualHostKey no
#   ProxyCommand ssh -q -W %h:%p gateway.example.com
HashKnownHosts yes
StrictHostKeyChecking ask

and my sshd_config

Port 472
#AddressFamily any
ListenAddress 0.0.0.0
#ListenAddress ::

# The default requires explicit activation of protocol 1
Protocol 2

# HostKey for protocol version 1
#HostKey /etc/ssh/ssh_host_key
# HostKeys for protocol version 2
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_dsa_key

# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 1h
#ServerKeyBits 1024

# Logging
# obsoletes QuietMode and FascistLogging
#SyslogFacility AUTH
#LogLevel INFO

# Authentication:

LoginGraceTime 120
PermitRootLogin no
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

#RSAAuthentication yes
#PubkeyAuthentication yes
#AuthorizedKeysFile    .ssh/authorized_keys

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#RhostsRSAAuthentication no
# similar for protocol version 2
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# RhostsRSAAuthentication and HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no

# Change to no to disable s/key passwords
ChallengeResponseAuthentication no

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

# Set this to 'yes' to enable PAM authentication, account processing, 
# and session processing. If this is enabled, PAM authentication will 
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes

#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding no
#X11DisplayOffset 10
#X11UseLocalhost yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS yes
#PidFile /var/run/sshd.pid
#MaxStartups 10
#PermitTunnel no
#ChrootDirectory none

# no default banner path
#Banner /etc/issue

# override default of no subsystems
Subsystem    sftp    /usr/lib/ssh/sftp-server

# Example of overriding settings on a per-user basis
#Match User anoncvs
#    X11Forwarding no
#    AllowTcpForwarding no
#    ForceCommand cvs server

AllowUsers    vic

Is this a misunderstanding of the putty > ssh connection process on my part?

Last edited by supulton (2010-07-15 06:37:24)

Offline

#2 2010-07-15 06:12:02

mikesd
Member
From: Australia
Registered: 2008-02-01
Posts: 788
Website

Re: [SOLVED] putty doesn't use a keyfile?

I use PuTTY from work to access my machines at home. PuTTY just needs to be told to use a key file. See "Connection -> SSH -> Auth -> Private key file for authentication." in the menu. You could also use Paegant, PuTTY's key agent.

Offline

#3 2010-07-15 06:26:17

supulton
Member
Registered: 2008-12-31
Posts: 58

Re: [SOLVED] putty doesn't use a keyfile?

mikesd wrote:

I use PuTTY from work to access my machines at home. PuTTY just needs to be told to use a key file. See "Connection -> SSH -> Auth -> Private key file for authentication." in the menu. You could also use Paegant, PuTTY's key agent.

Yes, I knew this; I actually just tested the key and it worked fine. My problem, however, is that when Putty isn't supplied a key file, it defaults to asking for my user and password information that I use on my arch box, rather than simply refusing to connect for not having a key.

This seems very insecure, as somebody who knew my IP and port number could easily brute force into my system. Is there any way to configure putty/ssh so that it would refuse connection rather than ask for my login information when not supplied with a valid keyfile?

Offline

#4 2010-07-15 06:36:38

supulton
Member
Registered: 2008-12-31
Posts: 58

Re: [SOLVED] putty doesn't use a keyfile?

Setting PasswordAuthentication to 'no' in /etc/ssh/sshd_config seems to be exactly what I was after. smile

Offline

Board footer

Powered by FluxBB