Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: Newbie ssh Trouble

  1. #1
    Join Date
    Mar 2013
    Beans
    8

    Newbie ssh Trouble

    Hi there,

    First time poster, first time user. Total linux noob, although I've kicked around the idea for a while. Anyway, can't find a real answer after hours of searching.

    I wanted to fool around with having a home server. I have an old windows laptop I'm not using, so I figured I'd use that. I download the latest ubuntu server edition and install it correctly. I get intimidated by just having the command line and go ahead and download the latest (12.10) ubuntu desktop version and install it. Everything is great, install all the necessary updates including openssh.

    My plan was to get to this point and walk away and begin doing the rest via ssh from my other home computers (I am also a ssh noob). I begin on my mac laptop because it's easier than installing putty on my windows desktop. I try to connect like this:

    Code:
    ssh -l [yourusername] [your server's hostname]
    That doesn't work, I get a message saying something to the effect of that hostname doesn't exist (I assure you. it does). Then I tried it like this:

    Code:
    ssh -l [yourusername]@[ipaddress]
    After trying to connect via my servers dynamic ip address, it looks like it's working and then I am greeted with "connection timed out".

    Did some research figured I needed to change the port on the server and forward the port on my router. Change the config on the server to port 2222, then forward port 2222 on my router using my servers ip address.

    For the heck of it I also installed putty on my windows desktop and proceeded to try it with the new port. I was greeted with the exact same results.

    All I want to do is initially set up a safe server in my home that I can use to share media amongst my home computers. Can someone please help me set up ssh appropriately?? I cannot figure it out. Thanks.

  2. #2
    Join Date
    Jan 2008
    Location
    Manchester UK
    Beans
    13,646
    Distro
    Ubuntu

    Re: Newbie ssh Trouble

    Have you got openssh-server installed on the laptop ?

    You should not need to mess about with ports.

  3. #3
    Join Date
    Mar 2013
    Beans
    8

    Re: Newbie ssh Trouble

    Yes, as far as I know. Once the OS was installed I typed this


    Code:
    sudo apt-get update 
    
    sudo apt-get install openssh-server
    I assumed after that was done it was installed.

  4. #4
    Join Date
    Apr 2012
    Beans
    4,571

    Re: Newbie ssh Trouble

    If you're doing this within a single LAN subnet there should be no need to either change the default port (22) or forward ports

    You can check whether the ssh server is running and listening using

    Code:
    sudo netstat -nlp | grep ssh
    (on the machine you're tryng to connect to) - as well, make sure your server's firewall is either disabled or configured to allow ssh traffic

    Code:
    sudo ufw status
    You can start the ssh client in verbose mode to get more info about why it's failing

    Code:
    ssh -vvv -l [yourusername] [your server's LAN IP]
    [In my experience, LAN hostnames are flaky - unless you have explicitly set them in your hosts files they rely on avahi services and a cooperative router]

  5. #5
    Join Date
    Mar 2013
    Beans
    8

    Re: Newbie ssh Trouble

    Alright, well I will certainly report back once I'm home. Just to clarify, do I type these commands on the server or on the computer I'm trying to connect to the server through (client?)

  6. #6
    Join Date
    Apr 2012
    Beans
    4,571

    Re: Newbie ssh Trouble

    first 2 on the server

    last one on the client

  7. #7
    Join Date
    Mar 2013
    Beans
    8

    Re: Newbie ssh Trouble

    After switching the config back to the default port 22, I tried these commands last night. Here are the results:

    Server:
    Code:
    [username]@[hostname]:~$ sudo netstat -nlp | grep ssh
    [sudo] password for [username]:
    unix  2      [ ACC ]     STREAM     LISTENING     13987    1803/ssh-agent      /tmp/ssh-hDPZHqidWIFi/agent.1768
    unix  2      [ ACC ]     STREAM     LISTENING     14262    1757/gnome-keyring- /run/user/[username]/keyring-XTv26L/ssh
    [username]@[hostname]:~$ sudo ufw status
    Status: inactive
    Client:
    Code:
    [name]:~ [name]$ ssh -vvv  -l [username] [server ip]
    OpenSSH_5.2p1, OpenSSL 0.9.8r 8 Feb 2011
    debug1: Reading configuration data /etc/ssh_config
    debug2: ssh_connect: needpriv 0
    debug1: Connecting to [server ip] [server ip] port 22.
    debug1: connect to address [server ip] port 22: Operation timed out
    ssh: connect to host [server ip] port 22: Operation timed out
    Does that help at all? What am I doing wrong?

  8. #8
    Join Date
    Apr 2012
    Beans
    4,571

    Re: Newbie ssh Trouble

    It looks like there is no ssh server running on the target machine - you should see something like

    Code:
    $ sudo netstat -nlp | grep ssh
    tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      2422/sshd
    tcp6       0      0 :::22                   :::*                    LISTEN      2422/sshd
    unix  2      [ ACC ]     STREAM     LISTENING     1654639  24955/gnome-keyring /tmp/keyring-ULu0Jf/ssh
    unix  2      [ ACC ]     STREAM     LISTENING     1654946  25001/ssh-agent     /tmp/ssh-abMMOgi24966/agent.24966
    You can also check with
    Code:
    $ service ssh status
    ssh start/running, process 2422
    If it doesn't appear to be started you can try manually with

    Code:
    sudo service ssh start
    To check that the package is actually installed

    Code:
    dpkg -l | grep openssh
    (which will show both the openssh-server and openssh-client packages if they are installed) or

    Code:
    apt-cache policy openssh-server
    Last edited by steeldriver; March 28th, 2013 at 02:26 PM.

  9. #9
    Join Date
    Mar 2013
    Beans
    8

    Re: Newbie ssh Trouble

    Thanks, I'll try those out later. In the future, will I have to manually start openssh every time I want to access it on a client?

  10. #10
    Join Date
    Apr 2012
    Beans
    4,571

    Re: Newbie ssh Trouble

    no it should start automatically, if it's failing to start for some reason we will need to figure out why

Page 1 of 2 12 LastLast

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
  •