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

Thread: Unable to launch SSH daemon automatically at start-up

  1. #1
    Join Date
    Jul 2009
    Beans
    69
    Distro
    Ubuntu 10.04 Lucid Lynx

    Talking Unable to launch SSH daemon automatically at start-up

    Hello Ubuntu forum.

    It is my first post on this forum, so if they are some specific rules or requirement, do not hesitate to explain.

    I have installed Kubuntu for desktop on my laptop a couple of days ago and feel quite satisfied. Moreover, I really impressed by the Ubuntu documentation, which is very extensive, detailed and easy-to-read.

    I am now facing a small issue. I want to have the daemon SSH automatically started up on boot. So I have done a classical :

    Code:
    sudo update-rc.d ssh defaults
    I tried with another priority :

    Code:
    sudo update-rc.d -f ssh remove
    sudo update-rc.d ssh start 50 2 3 4 5 . stop 50 0 1 6 .
    Everything looks OK :

    Code:
    arnaud@KubuntuBox:~$ ls /etc/rc*
    /etc/rc.local
    
    /etc/rc0.d:
    K01kdm               K74bluetooth                        S31umountnfs.sh
    K02usplash           K99laptop-mode                      S35networking
    K20apport            README                              S40umountfs
    K25hwclock.sh        S01linux-restricted-modules-common  S60umountroot
    K50alsa-utils        S15wpa-ifupdown                     S90halt
    K50ssh               S20sendsigs
    K63mountoverflowtmp  S30urandom
    
    /etc/rc1.d:
    K01kdm      K20acpi-support  K21apmd          K88dbus         S30killprocs
    K02usplash  K20apport        K39ufw           K89klogd        S70bootlogs.sh
    K11anacron  K20hotkey-setup  K50ssh           K90sysklogd     S70dns-clean
    K11atd      K20rsync         K74bluetooth     K99laptop-mode  S70pppd-dns
    K11cron     K20saned         K80cups          K99policykit    S90single
    K16hal      K21acpid         K86avahi-daemon  README
    
    /etc/rc2.d:
    README        S20hotkey-setup    S50saned        S98usplash
    S01policykit  S24hal             S50ssh          S99acpi-support
    S10acpid      S25bluetooth       S70bootlogs.sh  S99laptop-mode
    S10apmd       S30kdm             S70dns-clean    S99ondemand
    S10sysklogd   S50avahi-daemon    S70pppd-dns     S99rc.local
    S11klogd      S50cups            S89anacron      S99rmnologin
    S12dbus       S50NetworkManager  S89atd          S99stop-readahead
    S20apport     S50rsync           S89cron
    
    /etc/rc3.d:
    README        S20hotkey-setup    S50saned        S98usplash
    S01policykit  S24hal             S50ssh          S99acpi-support
    S10acpid      S25bluetooth       S70bootlogs.sh  S99laptop-mode
    S10apmd       S30kdm             S70dns-clean    S99ondemand
    S10sysklogd   S50avahi-daemon    S70pppd-dns     S99rc.local
    S11klogd      S50cups            S89anacron      S99rmnologin
    S12dbus       S50NetworkManager  S89atd          S99stop-readahead
    S20apport     S50rsync           S89cron
    
    /etc/rc4.d:
    README        S20hotkey-setup    S50saned        S98usplash
    S01policykit  S24hal             S50ssh          S99acpi-support
    S10acpid      S25bluetooth       S70bootlogs.sh  S99laptop-mode
    S10apmd       S30kdm             S70dns-clean    S99ondemand
    S10sysklogd   S50avahi-daemon    S70pppd-dns     S99rc.local
    S11klogd      S50cups            S89anacron      S99rmnologin
    S12dbus       S50NetworkManager  S89atd          S99stop-readahead
    S20apport     S50rsync           S89cron
    
    /etc/rc5.d:
    README        S20hotkey-setup    S50saned        S98usplash
    S01policykit  S24hal             S50ssh          S99acpi-support
    S10acpid      S25bluetooth       S70bootlogs.sh  S99laptop-mode
    S10apmd       S30kdm             S70dns-clean    S99ondemand
    S10sysklogd   S50avahi-daemon    S70pppd-dns     S99rc.local
    S11klogd      S50cups            S89anacron      S99rmnologin
    S12dbus       S50NetworkManager  S89atd          S99stop-readahead
    S20apport     S50rsync           S89cron
    
    /etc/rc6.d:
    K01kdm               K74bluetooth                        S31umountnfs.sh
    K02usplash           K99laptop-mode                      S35networking
    K20apport            README                              S40umountfs
    K25hwclock.sh        S01linux-restricted-modules-common  S60umountroot
    K50alsa-utils        S15wpa-ifupdown                     S90reboot
    K50ssh               S20sendsigs
    K63mountoverflowtmp  S30urandom
    
    /etc/rcS.d:
    README                              S35mountall.sh
    S01mountkernfs.sh                   S36mountall-bootclean.sh
    S01readahead                        S37apparmor
    S02hostname.sh                      S37mountoverflowtmp
    S06keyboard-setup                   S37udev-finish
    S07linux-restricted-modules-common  S39readahead-desktop
    S10udev                             S39ufw
    S11mountdevsubfs.sh                 S40networking
    S13pcmciautils                      S45mountnfs.sh
    S15module-init-tools                S46mountnfs-bootclean.sh
    S17procps                           S49console-setup
    S20checkroot.sh                     S55bootmisc.sh
    S22mtab.sh                          S55urandom
    S25brltty                           S70screen-cleanup
    S30checkfs.sh                       S70x11-common
    Please note the the conf file is OK. When manually started up, I can connect to my laptop without any problem

    I suspect some dependencies or something like that.

    Any idea will help.

    Thank you in advance for your support !

  2. #2
    Join Date
    Sep 2007
    Beans
    134
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: Unable to launch SSH daemon automatically at start-up

    Quote Originally Posted by emma_peel View Post
    I want to have the daemon SSH automatically started up on boot.
    Assuming you have installed openssh-server, it will start from /etc/init.d/ssh. If the server has been installed and the /etc/init.d/ssh file exists but doesn't seem to work, I'd execute a dpkg-reconfigure openssh-server.

    Bob

  3. #3
    Join Date
    Jul 2009
    Beans
    69
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Unable to launch SSH daemon automatically at start-up

    Hello Hrod & thank you for the reply.

    I fact the SSH daemon is working fine. I have configured I used to. When launch manually, I can connect to it without any problems.

    I just want to have it automatically started on boot.

  4. #4
    Join Date
    Jul 2009
    Beans
    69
    Distro
    Ubuntu 10.04 Lucid Lynx

    Angry Re: Unable to launch SSH daemon automatically at start-up

    Hello.

    A little UP for this thread.

    I tried the reconfigure dpkg switch, without success.

    Just in cas, I have installed the apache2 package. The daemon is properly launched, everything works fine for it.

    I have tried a couple of priority level, including the one used by apache2 ... still no result.

    This is probably something stupid that will look obvious afterwards, but I'm currently stuck ... any idea would be appreciated.

  5. #5
    Join Date
    Jul 2009
    Beans
    69
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Unable to launch SSH daemon automatically at start-up

    I found something that may be interesting :

    Code:
    arnaud@KubuntuBox:/$ grep sshd /var/log/auth.log
    Jul 29 22:55:17 KubuntuBox sshd[3046]: error: Bind to port 22 on 192.168.1.101 failed: Cannot assign requested address.
    Jul 29 22:55:17 KubuntuBox sshd[3046]: fatal: Cannot bind any address.
    Jul 29 22:57:22 KubuntuBox sshd[3550]: Server listening on 192.168.1.101 port 22.
    Jul 29 22:58:22 KubuntuBox sshd[3554]: Accepted publickey for arnaud from 192.168.1.204 port 50423 ssh2
    Jul 29 22:58:23 KubuntuBox sshd[3554]: pam_unix(sshd:session): session opened for user arnaud by (uid=0)
    It looks like there are errors during sshd start up. But how to correct them ?

  6. #6
    Join Date
    Jul 2009
    Beans
    69
    Distro
    Ubuntu 10.04 Lucid Lynx

    Thumbs up Re: Unable to launch SSH daemon automatically at start-up

    I finally resolve the issue by commenting the listen adresse param :

    Code:
    arnaud@KubuntuBox:/etc/ssh$ cat sshd_config
    # Quick config file
    # Copied from virologie.free.fr
    Port                     22
    Protocol                 2
    #ListenAddress            192.168.1.101
    ServerKeyBits            1024
    PermitRootLogin          no
    
    PubkeyAuthentication     yes
    IgnoreRhosts             yes
    AuthorizedKeysFile       .ssh/authorized_keys
    PasswordAuthentication   no
    
    UsePAM                   yes
    Compression              yes
    And ... it works !

  7. #7
    Join Date
    Jun 2006
    Location
    England
    Beans
    127

    Re: Unable to launch SSH daemon automatically at start-up

    Quote Originally Posted by emma_peel View Post
    I finally resolve the issue by commenting the listen adresse param :

    !
    Ah brilliant. I'm just getting to grips with ssh now and like you it wouldn't launch on boot but now I've found your post and disabled the listen address param it works perfectly so thanks for posting the answer, it's greatly appreaciated.
    Desktop: AMD 4200 64+ X2 - 4GB ram - nVidia 8600GT (512mb ram) - Ubuntu 8.04 / Win XP (Games) - Mac Mini - CD 1.6ghz - 1GB RAM - 80GB HD
    Laptop: MacBook Pro - 2.4ghz C2D - 15.4 glossy - 200GB HD - 4GB RAM

  8. #8
    Join Date
    Jun 2009
    Location
    Dublin, IRL
    Beans
    130
    Distro
    Ubuntu 10.04 Lucid Lynx

    Talking Re: Unable to launch SSH daemon automatically at start-up

    Finally, a solution to this! Thanks for posting.
    This does work.
    This error caused me great irritation.

    The commenting of the ListenAddress entry causes the OpenBSD sshd service to restart 3 times at boot. This can be seen on the local vga screen attached to the server.
    When I try to log into sshd immediately after reboot from a client the service is unavailable and my connection attempt gets "No Route to Host" error. The after 1 minute I can connect.
    If I look at the local server screen I can then see that sshd was restarting and did so 3 times.

    If sshd is run in Debug mode with out the comment on the ListenAddress line the error is "cannot bind" in /var/log/messages
    I think the network interface has not yet recieved it's i.p. address from the dhcp server and the sshd service cannot bind to the configured i.p. set in the ListenAddress directive in sshd_config. Without the directive it reboots until it has an address.
    I tried a wild card [*] instead of commenting out but it was considered 'garbage'...

  9. #9
    Join Date
    Feb 2010
    Beans
    1

    Re: Unable to launch SSH daemon automatically at start-up

    Sorry to resurrect an old thread (esp. on my first post!) but I was struggling with this and wanted to add my solution for the benefit of future searchers.

    To restate the problem:

    SSH was not starting correctly on system startup after a pretty standard install. The ssh daemon was running (ps -ef|grep ssh), but I couldn't get in from a remote client. Once logging in on the server, issuing sudo /etc/init.d/shh restart on the box correctly restarted it, and I could access it remotely. Obviously this is no good for a headless machine, having to login at the physical box every restart.

    Problem, as identified above, is that SSH wasn't binding to the ListenAddress in its config, because network has not been fully initialized/got its IP from DCHP when sshd starts up. The solution above (remove listenaddress from config) seems to work, but that might limit what you can do with SSH - as I understand it, you need ListenAddress to correctly set up remote access over public internet. (according to this at least)

    So if you want ListenAddress instructions in your config and also want it to start correctly at startup, you need to do the following workaround, found here. The way this works is that every time NetworkManager changes address it will try and restart SSH. Not the pretties workaround, but it does the job.

    $ su
    Password:
    # cd /etc/NetworkManager/dispatcher.d/
    # echo /etc/init.d/ssh restart > ./10ssh
    # chmod 755 ./10ssh

    Hope that helps someone!

  10. #10
    Join Date
    Jul 2009
    Beans
    69
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Unable to launch SSH daemon automatically at start-up

    That looks a very clean solution and even far better. That may allow to launch SSH when connected to the wired network, and stop when connected by wifi.

    I guess that a fixed IP should also work, but do not wanna try on my headless server.

    Thank you for sharing your experience.

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
  •