Page 1 of 4 123 ... LastLast
Results 1 to 10 of 32

Thread: Using Putty and OpenSSH

  1. #1
    Join Date
    Nov 2013
    Beans
    13

    Using Putty and OpenSSH

    I've just installed Ubuntu Server 12.04.3 LTS and am trying to set-up OpenSSH so that I can use Putty on my Windows 7 machine located on the same network to access the Linux machine.
    Using 'ssh localhost' on the Linux machine allows me to SSH into the same machine, however trying to access the Linux machine with Putty on the Windows 7 machine (using the IP address given under ifconfig's 'inet address') results in the error 'server unexpectedly closed network connection'.
    OpenSSH is installed and the sshd_config file has been left with its default values as changing the values as suggested at https://help.ubuntu.com/community/SS...SH/Configuring gave the same result with Putty.

  2. #2
    Join Date
    Sep 2006
    Beans
    8,627
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Using Putty and OpenSSH

    Are you using UFW or iptables to filter your server? If so, then you'll need to open up port 22 (ssh)

    Code:
    sudo ufw allow ssh

  3. #3
    Join Date
    Nov 2013
    Beans
    13

    Re: Using Putty and OpenSSH

    Quote Originally Posted by Lars Noodén View Post
    Are you using UFW or iptables to filter your server? If so, then you'll need to open up port 22 (ssh)

    Code:
    sudo ufw allow ssh
    I'm not sure if I'm using UFW or iptables, I've just got the default Ubuntu with LAMP installation, perhaps there is a way I can find out to tell you? Saying that, I entered the command you suggested and got the following:

    Code:
    Rules updated
    Rules updated (v6)
    This then changed my Putty error message to 'Network Error: Connection timed out', what would I need to do next?
    Last edited by edencrow; November 16th, 2013 at 04:13 PM.

  4. #4
    Join Date
    Apr 2012
    Beans
    7,256

    Re: Using Putty and OpenSSH

    Do you still have the modified sshd_config file on the target server? does it allow PasswordAuthentication (I noticed the instructions you linked say to disable that option) - you will need that option at least until you set up key-based authentication

  5. #5
    Join Date
    Sep 2006
    Beans
    8,627
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Using Putty and OpenSSH

    I'm not quite sure how to reproduce this problem.

    Lack of keys would give an error something like 'Permission denied (publickey,keyboard-interactive)', when you have password authentication turned off but try anyway.

  6. #6
    Join Date
    Nov 2013
    Beans
    13

    Re: Using Putty and OpenSSH

    Quote Originally Posted by steeldriver View Post
    Do you still have the modified sshd_config file on the target server? does it allow PasswordAuthentication (I noticed the instructions you linked say to disable that option) - you will need that option at least until you set up key-based authentication
    Here is my sshd_config file currently, which has gone back to the original server unexpectedly closed network connection:

    Code:
    Host *
    # ForwardAgent no
    # ForwardX11 no
    # ForwardX11Trusted yes
    # RhostsRSAAuthentication no
    # RSAAuthentication yes
    PasswordAuthentication yes
    # HostbasedAuthentication no
    # GSSAPAuthentication no
    # GSSAPIDelegateCredentails no
    # GSSAPIKeyExchange no
    # GSSAPITrustDNS no
    # BatchMode no
    # CheckHostIP yes
    # AddressFamily any
    # ConnectTimeout 0
    # StrictHostKeyChecking ask
    # IdentifyFile ~/.ssh/identity
    # IdentifyFile ~/.ssh/id_rsa
    # Identifyfile ~/.ssh/id_dsa
    Port 22
    # Protocol 2,1
    # Cipher 3des
    # Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfiur128,aes128-cbc,3des,cbc
    # MACs hmac-md5,umac-64@openssh.com,hmac-ripem160
    # EscapeChar ~
    # Tunnel no
    # TunnelDevice any:any
    # PermitLocalCommand no
    # VirtualHostKey no
    # ProxyCommand ssh -q -W %h%p gateway.example.com
    SendEnv LANG LC_*
    HasKnownHosts yes
    GSAPIAuthentication yes
    GSSAPIDelegateCredentials no
    Last edited by edencrow; November 16th, 2013 at 04:54 PM.

  7. #7
    Join Date
    Apr 2012
    Beans
    7,256

    Re: Using Putty and OpenSSH

    That looks like /etc/ssh_config (the ssh client config file) - not /etc/sshd_config (the server config file)

  8. #8
    Join Date
    Sep 2006
    Beans
    8,627
    Distro
    Ubuntu 14.04 Trusty Tahr

    gssapi

    "GSAPIAuthentication yes" is not in the default and looks spelled wrong. Can you rem that out or temporarily use a default configuration file?

    Code:
    Port 22
    Protocol 2
    HostKey /etc/ssh/ssh_host_rsa_key
    HostKey /etc/ssh/ssh_host_dsa_key
    HostKey /etc/ssh/ssh_host_ecdsa_key
    UsePrivilegeSeparation yes
    KeyRegenerationInterval 3600
    ServerKeyBits 768
    SyslogFacility AUTH
    LogLevel INFO
    LoginGraceTime 120
    PermitRootLogin yes
    StrictModes yes
    RSAAuthentication yes
    PubkeyAuthentication yes
    IgnoreRhosts yes
    RhostsRSAAuthentication no
    HostbasedAuthentication no
    PermitEmptyPasswords no
    ChallengeResponseAuthentication no
    X11Forwarding yes
    X11DisplayOffset 10
    PrintMotd no
    PrintLastLog yes
    TCPKeepAlive yes
    AcceptEnv LANG LC_*
    Subsystem sftp /usr/lib/openssh/sftp-server
    UsePAM yes
    You can test the configuration file's syntax with the -T option:

    Code:
    /usr/sbin/sshd -T

  9. #9
    Join Date
    Nov 2013
    Beans
    13

    Re: Using Putty and OpenSSH

    Quote Originally Posted by steeldriver View Post
    That looks like /etc/ssh_config (the ssh client config file) - not /etc/sshd_config (the server config file)
    Ah, yes, it does indeed say 'This is the ssh client system-wide configuration file'. Many apologies, I am new at this. I've put the client configuration file back to its default values:

    Code:
    Host *
    # ForwardAgent no
    # ForwardX11 no
    # ForwardX11Trusted yes
    # RhostsRSAAuthentication no
    # RSAAuthentication yes
    # PasswordAuthentication yes
    # HostbasedAuthentication no
    # GSSAPAuthentication no
    # GSSAPIDelegateCredentails no
    # GSSAPIKeyExchange no
    # GSSAPITrustDNS no
    # BatchMode no
    # CheckHostIP yes
    # AddressFamily any
    # ConnectTimeout 0
    # StrictHostKeyChecking ask
    # IdentifyFile ~/.ssh/identity
    # IdentifyFile ~/.ssh/id_rsa
    # Identifyfile ~/.ssh/id_dsa
    # Port 22
    # Protocol 2,1
    # Cipher 3des
    # Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfiur128,aes128-cbc,3des,cbc
    # MACs hmac-md5,umac-64@openssh.com,hmac-ripem160
    # EscapeChar ~
    # Tunnel no
    # TunnelDevice any:any
    # PermitLocalCommand no
    # VirtualHostKey no
    # ProxyCommand ssh -q -W %h%p gateway.example.com
    SendEnv LANG LC_*
    HasKnownHosts yes
    GSSAPIAuthentication yes
    GSSAPIDelegateCredentials no
    However, I can not seem to be able to find a file named 'sshd_config' within /etc/ssh or /etc/. Is there somewhere else on my system I should look or a default example that I can copy over?

    EDIT: Lars, looks like we posted at the same time, am reading the response from you and The Cog atm.
    Last edited by edencrow; November 16th, 2013 at 05:09 PM.

  10. #10
    Join Date
    Nov 2007
    Location
    London, England
    Beans
    7,701

    Re: Using Putty and OpenSSH

    Turning on the firewall when you are already having connectivity issues isn't helpful. Let's turn it off again:
    Code:
    sudo ufw disable
    Let's have a look at what ports are listening on the Ubuntu server. Please post the results of:
    Code:
    netstat -lnt
    Please check that you are setting putty to use port 22 (should happen when you select ssh, but its default is for telnet on port 23). The symptoms you describe could be explained by putty trying to connect to telnet 23 instead of ssh 22.

Page 1 of 4 123 ... LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •