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

Thread: How to ssh localhost .

  1. #1
    Join Date
    Apr 2010
    Beans
    19

    Unhappy How to ssh localhost .

    I try to ssh localhost it always immediately Terminated .



    How do i resolve this problem

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

    Re: How to ssh localhost .

    Try connecting as a user other than root.

    Logging remotely as root is generally frowned upon, there is usually a safer way. And the default for Ubuntu these days is to block root login without keys.

    Edit: If you check your /etc/ssh/sshd_config for the line PermitRootLogin you will see that you need to log in as another user.
    Last edited by Lars Noodén; March 24th, 2015 at 11:25 AM.

  3. #3
    Join Date
    Apr 2010
    Beans
    19

    Re: How to ssh localhost .

    I used permitRootLogin Yes and reboot


    Try to another user but it is same problem


    Can everyone help me ?

    I can not used putty to this server it is the same problem as ssh to localhost.

    Note.
    Before append this problem i forget root password and used ubuntu recovery mode to reset root password. after that i can not use putty to ssh this server.

    I capture this picture from terminal monitor.

    thanks for you help.
    Last edited by howefield; March 24th, 2015 at 02:04 PM.

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

    Re: How to ssh localhost .

    What is the output of the ssh client if you connect in very, very verbose mode?

    Code:
    ssh -vvv noktualek@localhost
    You can put the output between [code] [/code] tags here and it will get formatted properly.

    Note that what you have here won't work because it will try to run the command 'localhost' upon logging in and there probably is not such a command on your machine if you did not write it yourself:

    Code:
    ssh -vvv noktualek@localhost localhost

  5. #5
    Join Date
    Apr 2010
    Beans
    19

    Re: How to ssh localhost .

    result
    Code:
    ssh -vvv noktualek@localhost localhost 
    
    OpenSSH_5.9p1 Debian-5ubuntu1.4, OpenSSL 1.0.1 14 Mar 2012
    debug1: Reading configuration data /etc/ssh/ssh_config
    debug1: /etc/ssh/ssh_config line 19: Applying options for *
    debug2: ssh_connect: needpriv 0
    debug1: Connecting to localhost [127.0.0.1] port 22.
    debug1: Connection established.
    debug1: permanently_set_uid: 0/0
    debug1: identity file /root/.ssh/id_rsa type -1
    debug1: identity file /root/.ssh/id_rsa-cert type -1
    debug3: Incorrect RSA1 identifier
    debug3: Could not load "/root/.ssh/id_dsa" as a RSA1 public key
    debug1: identity file /root/.ssh/id_dsa type 2
    debug1: Checking blacklist file /usr/share/ssh/blacklist.DSA-1024
    debug1: Checking blacklist file /etc/ssh/blacklist.DSA-1024
    debug1: identity file /root/.ssh/id_dsa-cert type -1
    debug1: identity file /root/.ssh/id_ecdsa type -1
    debug1: identity file /root/.ssh/id_ecdsa-cert type -1
    debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian-5ubuntu1.4
    debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1.4 pat OpenSSH*
    debug1: Enabling compatibility mode for protocol 2.0
    debug1: Local version string SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1.4
    debug2: fd 3 setting O_NONBLOCK
    debug1: SSH2_MSG_KEXINIT sent
    debug1: SSH2_MSG_KEXINIT received
    debug2: kex_parse_kexinit: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
    debug2: kex_parse_kexinit: ecdsa-sha2-nistp256-cert-v01@openssh...00@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-rsa,ssh-dss
    debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
    debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
    debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-sha2-256,hmac-sha2-256-96,hmac-sha2-512,hmac-sha2-512-96,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
    debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-sha2-256,hmac-sha2-256-96,hmac-sha2-512,hmac-sha2-512-96,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
    debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
    debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
    debug2: kex_parse_kexinit: 
    debug2: kex_parse_kexinit: 
    debug2: kex_parse_kexinit: first_kex_follows 0 
    debug2: kex_parse_kexinit: reserved 0 
    debug2: kex_parse_kexinit: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
    debug2: kex_parse_kexinit: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256
    debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
    debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
    debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-sha2-256,hmac-sha2-256-96,hmac-sha2-512,hmac-sha2-512-96,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
    debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-sha2-256,hmac-sha2-256-96,hmac-sha2-512,hmac-sha2-512-96,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
    debug2: kex_parse_kexinit: none,zlib@openssh.com
    debug2: kex_parse_kexinit: none,zlib@openssh.com
    debug2: kex_parse_kexinit: 
    debug2: kex_parse_kexinit: 
    debug2: kex_parse_kexinit: first_kex_follows 0 
    debug2: kex_parse_kexinit: reserved 0 
    debug2: mac_setup: found hmac-md5
    debug1: kex: server->client aes128-ctr hmac-md5 none
    debug2: mac_setup: found hmac-md5
    debug1: kex: client->server aes128-ctr hmac-md5 none
    debug1: sending SSH2_MSG_KEX_ECDH_INIT
    debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
    debug1: Server host key: ECDSA 70:ec:b2:10:f9:b5:b7:64:ff:90:50:41:4d:7c:d9:07
    Last edited by howefield; March 24th, 2015 at 02:05 PM. Reason: add code tags

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

    Re: How to ssh localhost .

    That looks like only part of the output, it should get as far as asking for the password at least. Can you grab the whole thing? Also, as mentioned, don't try running any special command on the remote machine, let it go through to the shell like this:

    Code:
    ssh -vvv noktualek@localhost

  7. #7
    Join Date
    Apr 2010
    Beans
    19

    Re: How to ssh localhost .

    1 I try to
    # apt-get remove openssh-server
    # apt-get install openssh-sever
    2 Check /etc/hosts.deny
    ALL: 192.168.100.0 localhost 192.168.1.0

    3 Check /etc/hosts.deny
    not have any thing

    But problem is not prove.




    Last edited by howefield; March 24th, 2015 at 02:03 PM.

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

    Re: How to ssh localhost .

    Quote Originally Posted by noktualek View Post
    2 Check /etc/hosts.deny
    ALL: 192.168.100.0 localhost 192.168.1.0

    3 Check /etc/hosts.deny
    not have any thing
    Is #2 there supposed to be /etc/hosts.allow?

  9. #9
    Join Date
    Apr 2010
    Beans
    19

    Re: How to ssh localhost .

    The correct is

    2 Check /etc/hosts.allow
    ALL: 192.168.100.0 localhost 192.168.1.0

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

    Re: How to ssh localhost .

    Ok. Since you have local access, we can then also watch what the server tries to do.

    Set up the server for a single login in very, very verbose mode:

    Code:
    service ssh stop
    /usr/sbin/sshd -ddd
    Then try logging in.

    Please paste the results here.

    Then restore the service to normal.

    Code:
    service ssh start

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
  •