Results 1 to 7 of 7

Thread: apt-get install ssh without starting?

Hybrid View

  1. #1

    apt-get install ssh without starting?

    Is there any way to "apt-get install ssh" without having it automatically start sshd? Same for "lighttpd".

    Basically, I'm making great progress in my bootable QEMU image script, but when I chroot in to install packages it automatically starts them up. This isn't too horrible -- I can just stop them -- but it complicates my script and leaves a slightly polluted image behind. (Furthermore, stopping a process inside a chroot is annoying because you first must mount /proc inside.)

    Is there any "-o" option to the ssh and lighttpd installers to do everything *except* start them? Thanks!

    -david

  2. #2
    Join Date
    Apr 2007
    Location
    An Aperture Science Lab
    Beans
    1,287

    Re: apt-get install ssh without starting?

    I believe you can do this with sysv-rc-conf. This you can use to disable services on boot up. FYI it needs to be run from the terminal.

    Install it like so:
    Code:
    sudo apt-get install sysv-rc-conf
    Last edited by NullHead; July 12th, 2008 at 02:34 AM.
    I reject your reality and substitute my own.

  3. #3

    Re: apt-get install ssh without starting?

    Well, that will let me stop it from starting on future boots, but that's not quite what I'm looking to do.

    Rather, I *do* want it to start on future boots. I just don't want it to start immediately after installation.

    Any tips for that?

    Thanks!

    -david

  4. #4
    Join Date
    Apr 2007
    Location
    An Aperture Science Lab
    Beans
    1,287

    Re: apt-get install ssh without starting?

    um ... they should already start after installation.

    You can manually start/stop them by doing:
    Code:
    sudo /etc/init.d/sshd <start/stop>
    I reject your reality and substitute my own.

  5. #5

    Re: apt-get install ssh without starting?

    Yes, they do start after installation, and that's the problem: I don't want them to start right away. Rather, I want them to start up for the first time when the machine boots. I want to install lighttpd and take a snapshot of the totally-clean, never-run installation, and then reboot and have it start up for the first time. Any ideas?

  6. #6
    Join Date
    Mar 2008
    Beans
    4,714
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: apt-get install ssh without starting?

    Code:
    sudo apt-get --download-only install openssh-server
    cp /var/cache/apt/archives/openssh-server_1%3a4.6p1-5ubuntu0.5_i386.deb /tmp         # or some working dir
    cd /tmp
    dpkg --control openssh-server_1%3a4.6p1-5ubuntu0.5_i386.deb
    The control files will be deposited in a directory called /tmp/DEBIAN

    Look inside /tmp/DEBIAN/postinst:

    Code:
    setup_init() {
    	if [ -x /etc/init.d/ssh ]; then
    		update-rc.d ssh start 16 2 3 4 5 . stop 84 1 . >/dev/null
    		if [ -x /usr/sbin/invoke-rc.d ]; then
    			invoke-rc.d ssh restart
    		else
    			/etc/init.d/ssh restart
    		fi
    	fi
    }
    setup_init is the one of the functions called by the postinst script, and here we see the command that starts the sshd server.

    You could comment out
    Code:
    # 		if [ -x /usr/sbin/invoke-rc.d ]; then
    # 			invoke-rc.d ssh restart
    # 		else
    # 			/etc/init.d/ssh restart
    # 		fi
    Then you could build your own custom deb package with the modified postinst script.
    I don't know much about this last step; Here are some links which may help however: http://www.linuxdevices.com/articles/AT8047723203.html,
    http://ubuntuforums.org/showthread.php?t=51003

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
  •