Page 1 of 1

[SOLVED] - Prevent "ssh" from running on Boot!

Posted: Mon Apr 01, 2013 12:15 pm
by lkraemer
Linux Mint 14 - 32 Bit - XFCE Desktop

I've installed Openssh-server, and LM 14 installed Openssh-client on install.

I'm wanting to prevent sshd from starting on Boot of LM 14. What starts ssh (sshd) when I boot? I've been unable to locate any information about preventing ssh
from starting with all my Google searches.

I know I can stop it with:

Code: Select all

sudo stop ssh
but, I want it to start execution when I manually request it to run, not on boot.

Thanks.

Larry

Re: Prevent "ssh" from running on Boot!

Posted: Mon Apr 01, 2013 12:55 pm
by jawgrape
I think you want to investigate the " update-rc.d " facility.

There is a remove option. I have not used it so I will refrain from making a guess at the exact command and syntax.

check out the update-rc.d man page, and see i that helps.

Re: Prevent "ssh" from running on Boot!

Posted: Mon Apr 01, 2013 1:07 pm
by mockturtl
lkraemer wrote:What starts ssh (sshd) when I boot?
In Debian, you'd use update-rc.d to manage the links in /etc/rc*.d/.

I don't know if this is correct with Ubuntu's upstart, though.

http://unix.stackexchange.com/questions ... p-in-linux
http://blog.arithm.com/2012/09/24/ubunt ... date-rc-d/
http://en.positon.org/post/Disable-a-se ... -resistant

Re: Prevent "ssh" from running on Boot!

Posted: Mon Apr 01, 2013 2:24 pm
by jawgrape
This thread suggests that in ubuntu, sshd is started with update-rc, and there are several suggestions for keeping it from starting, although only a couple sound as if they are good best practice....

http://askubuntu.com/questions/56753/ho ... omatically

Re: Prevent "ssh" from running on Boot!

Posted: Mon Apr 01, 2013 2:48 pm
by altair4
In Ubuntu based Mint ssh is an upstart job. I do not believe any of the system-v methods of controlling service will work for upstart jobs.

You can edit the /etc/init/ssh.conf file itself to comment out the "start on" line or you can use this method:

From a terminal:

Code: Select all

sudo sh -c "echo 'manual' > /etc/init/ssh.override"
It creates an ssh.override file in /etc/init that simply has a one word entry of "manual". So if you go to /etc/init you will see 2 entries for ssh:
ssh.conf
ssh.override
The whole thing seems kind of kludgey to me personally but at least you can list /etc/init and see which upstart services you've set to override.

If you should decide in the future that you do want the service to start on boot you simply delete the ssh.override file.

Re: Prevent "ssh" from running on Boot!

Posted: Tue Apr 02, 2013 12:38 am
by lkraemer
altair4 & jawgrape,
Thanks, for that information on Upstart.

I had run across the Upstart info in searches after I posted for help. I'll have to swap my Hard Drive in the morning and try your suggestions.
(I'm trying out a SSD with Linux Mint 14 - 32 Bit - XFCE, and so far I love it. For the moment I'm using Slackware 14 - updated to -current.)

I'll let you know how it goes.

THANKS.

Larry.

Re: Prevent "ssh" from running on Boot!

Posted: Wed Apr 03, 2013 12:19 am
by lkraemer
altair4,
THANKS........Your suggestion worked PERFECT!

Code: Select all

sudo sh -c "echo 'manual' > /etc/init/ssh.override"
On restart sshd isn't started as seen by:

Code: Select all

/etc/init.d/./ssh status
* sshd is not running
Now, I can start/stop/restart sshd when I need it.

Code: Select all

sudo start ssh
sudo restart ssh
sudo stop ssh
I also found a reference at:
http://askubuntu.com/questions/56753/ho ... omatically
For versions with ssh started by upstart, run "touch /etc/ssh/sshd_not_to_be_run". The upstart init script checks for this file and, if existent, does not start sshd.
When I tried this method, sshd did not start on boot, but I could never get sshd running when I started ssh.
So, I kept the ssh.override method, which allows me to start/stop sshd as needed.

THANKS.

Larry