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

All Gurus once were Newbies
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. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read this

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

Postby lkraemer on Mon Apr 01, 2013 12:15 pm

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 lkraemer on Wed Apr 03, 2013 12:21 am, edited 1 time in total.
lkraemer
Level 2
Level 2
 
Posts: 52
Joined: Tue Apr 24, 2012 9:05 pm

Linux Mint is funded by ads and donations.
 

Re: Prevent "ssh" from running on Boot!

Postby jawgrape on Mon Apr 01, 2013 12:55 pm

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.
jawgrape
Level 1
Level 1
 
Posts: 29
Joined: Tue Mar 12, 2013 9:10 pm

Re: Prevent "ssh" from running on Boot!

Postby mockturtl on Mon Apr 01, 2013 1:07 pm

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/13/stop-program-running-at-startup-in-linux
http://blog.arithm.com/2012/09/24/ubuntus-upstart-versus-old-school-update-rc-d/
http://en.positon.org/post/Disable-a-service-with-update-rcd-under-Debian-update-resistant
Image
User avatar
mockturtl
Level 4
Level 4
 
Posts: 437
Joined: Sat Oct 09, 2010 8:51 pm

Re: Prevent "ssh" from running on Boot!

Postby jawgrape on Mon Apr 01, 2013 2:24 pm

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
jawgrape
Level 1
Level 1
 
Posts: 29
Joined: Tue Mar 12, 2013 9:10 pm

Re: Prevent "ssh" from running on Boot!

Postby altair4 on Mon Apr 01, 2013 2:48 pm

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.
altair4
Level 15
Level 15
 
Posts: 5925
Joined: Tue Feb 03, 2009 10:27 am

Re: Prevent "ssh" from running on Boot!

Postby lkraemer on Tue Apr 02, 2013 12:38 am

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
Level 2
Level 2
 
Posts: 52
Joined: Tue Apr 24, 2012 9:05 pm

Re: Prevent "ssh" from running on Boot!

Postby lkraemer on Wed Apr 03, 2013 12:19 am

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/how-do-i-disable-ssh-from-starting-automatically
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
lkraemer
Level 2
Level 2
 
Posts: 52
Joined: Tue Apr 24, 2012 9:05 pm

Linux Mint is funded by ads and donations.
 

Return to Newbie Questions

Who is online

Users browsing this forum: Bing [Bot], Exabot [Bot], Google Adsense [Bot] and 18 guests