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

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
lkraemer

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

Post 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
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
jawgrape

Re: Prevent "ssh" from running on Boot!

Post 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.
mockturtl

Re: Prevent "ssh" from running on Boot!

Post 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
jawgrape

Re: Prevent "ssh" from running on Boot!

Post 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
altair4
Level 20
Level 20
Posts: 11433
Joined: Tue Feb 03, 2009 10:27 am

Re: Prevent "ssh" from running on Boot!

Post 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.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
lkraemer

Re: Prevent "ssh" from running on Boot!

Post 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.
lkraemer

Re: Prevent "ssh" from running on Boot!

Post 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
Locked

Return to “Beginner Questions”