Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 13
Hello folks: Before posting I've already done some research, here is the problem: Code: solarbike@FBI:~$ ssh localhost ssh: connect to host localhost port 22: Connection refused Here is what I ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Sep 2007
    Posts
    11

    Exclamation ssh can't connect to localhost


    Hello folks:

    Before posting I've already done some research, here is the problem:

    Code:
    solarbike@FBI:~$ ssh localhost
    ssh: connect to host localhost port 22: Connection refused
    Here is what I know:
    • Since I'm ssh into my local machine from my local machine, It couldn't be my router even if I'm behind it right?
    • As far as I know I didn't install any firewall on my Ubuntu Gusty. Is there a way to check?
    • Both openssh-server and openssh-client are installed, with the configuration file for sshd properly set to listen to port 22.


    Any ideas?

  2. #2
    Just Joined!
    Join Date
    Jan 2008
    Posts
    9
    Hi Solarbike,

    First of all check if sshd is up:
    ps ax | grep [s]shd

    this should show smth like this:
    5059 ? Ss 0:00 /usr/sbin/sshd

    if no, try start sshd by command:
    /etc/init.d/ssh start

    2. Check if ssh is up at 22 port by command:
    netstat -ln | grep 22

    The output should show:
    tcp 0 0 :::22 :::* LISTEN

  3. #3
    Just Joined!
    Join Date
    Sep 2007
    Posts
    11
    Here is what I got:

    First of all check if sshd is up:
    ps ax | grep [s]shd
    20543 pts/0 R+ 0:00 grep sshd

    if no, try start sshd by command:
    /etc/init.d/ssh start
    * Starting OpenBSD Secure Shell server sshd [ OK ]
    solarbike@FBI:~$ ps ax|grep sshd
    20611 pts/0 R+ 0:00 grep sshd
    solarbike@FBI:~$ ssh localhost
    ssh: connect to host localhost port 22: Connection refused

    2. Check if ssh is up at 22 port by command:
    netstat -ln | grep 22
    unix 2 [ ACC ] STREAM LISTENING 20220 /tmp/orbit-solarbike/linc-1920-0-2315ec7e4be33
    unix 2 [ ACC ] STREAM LISTENING 20414 /tmp/orbit-solarbike/linc-1956-0-22139dd1bc6a

  4. #4
    Just Joined!
    Join Date
    Jan 2008
    Posts
    9
    SSH daemon fails, that's why you can't access ssh service via 22 port.

    Please try to start sshd with command and post output here:
    /usr/sbin/sshd -d

    Note: path to sshd may be different but in most cases it's /usr/sbin/sshd.

  5. #5
    Just Joined!
    Join Date
    Sep 2007
    Posts
    11
    it seems that my sshd is not a directory

    however, there is a file called sshd in my /usr/sbin

  6. #6
    Linux Guru coopstah13's Avatar
    Join Date
    Nov 2007
    Location
    NH, USA
    Posts
    3,149
    silly question but, is your loopback interface up?

  7. #7
    Just Joined!
    Join Date
    Sep 2007
    Posts
    11
    an even more silly answer: i don't know what loopback interface is.

  8. #8
    Linux Guru coopstah13's Avatar
    Join Date
    Nov 2007
    Location
    NH, USA
    Posts
    3,149
    type and show the output of this command
    Code:
    sudo ifconfig

  9. #9
    Just Joined!
    Join Date
    Sep 2007
    Posts
    11
    I guess I have loop back:

    Code:
    lo        Link encap:Local Loopback  
              inet addr:127.0.0.1  Mask:255.0.0.0
              inet6 addr: ::1/128 Scope:Host
              UP LOOPBACK RUNNING  MTU:16436  Metric:1
              RX packets:1183 errors:0 dropped:0 overruns:0 frame:0
              TX packets:1183 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0 
              RX bytes:968922 (946.2 KB)  TX bytes:968922 (946.2 KB)

  10. #10
    Just Joined!
    Join Date
    Sep 2007
    Posts
    11
    solved.

    I had to completely remove ssh (including ssh client and server and all other related packages), then reinstall.

Page 1 of 2 1 2 LastLast

Posting Permissions

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