LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-01-2011, 05:19 AM   #1
wang
Member
 
Registered: Dec 2010
Distribution: ubuntu 10.04
Posts: 43

Rep: Reputation: 0
how to enable/disable ssh server,at and not at boot time?


hi,friends!
i have just installed ssh-server in my Ubuntu 10.04,and really want to know how to
enable/disable it,and i also want to be sure if the changes will take effect after the next boot or not,and how to do that?
thanks for your help.
 
Old 03-01-2011, 05:25 AM   #2
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
To stop ssh server:
Code:
# sudo /etc/init.d/ssh stop
To start sshs server:
Code:
# sudo /etc/init.d/ssh start
To restart ssh server:
Code:
# sudo /etc/init.d/ssh restart
Kind regards
 
Old 03-01-2011, 05:35 AM   #3
wang
Member
 
Registered: Dec 2010
Distribution: ubuntu 10.04
Posts: 43

Original Poster
Rep: Reputation: 0
thanks.But what is the difference between "sudo /etc/init.d/ssh start" and "sudo /etc/init.d/ssh restart" ?
 
Old 03-01-2011, 05:44 AM   #4
tva
Member
 
Registered: Jul 2010
Location: Finland
Distribution: Open SUSE 13.1
Posts: 83

Rep: Reputation: 8
start starts server and restart first stops and then starts server. If your server isn't running it doesn't matter which command you use.
 
Old 03-01-2011, 06:04 AM   #5
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
start will start the ssh daemon, if the daemon doesn't run
restart will stop/restart the daemon, if the daemon is already running

Kind regards
 
Old 03-01-2011, 08:05 AM   #6
linuxrndblog
Member
 
Registered: Oct 2010
Location: India
Posts: 89

Rep: Reputation: 2
run following command:

chkconfig sshd on (for on boot time start)
chkconfig sshd off (for on boot time stop)
 
Old 03-01-2011, 08:35 PM   #7
Juako
Member
 
Registered: Mar 2010
Posts: 202

Rep: Reputation: 84
Quote:
Originally Posted by linuxrndblog View Post
run following command:

chkconfig sshd on (for on boot time start)
chkconfig sshd off (for on boot time stop)
Those commands are for red hat based systems, for example CentOS. In debian based systems the equivalent would be:
Code:
update-rc.d ssh defaults
update-rc.d ssh remove
For manual starting/stopping, with upstart based systems (newer ubuntus for example) you can use
Code:
service ssh start/stop/restart/reload
before upstart the "correct" way at least in ubuntu was
Code:
invoke-rc.d ssh start/stop/restart/reload
But invoking the script directly works across all variants:
Code:
sh /etc/init.d/ssh start/stop/restart/reload

Last edited by Juako; 03-02-2011 at 07:58 AM. Reason: corrected chkconfig example
 
Old 03-02-2011, 07:00 AM   #8
wang
Member
 
Registered: Dec 2010
Distribution: ubuntu 10.04
Posts: 43

Original Poster
Rep: Reputation: 0
one more confusion:
by
Code:
sudo update-rc.d sshd defaults
i got

nuli@nuli-laptop:~$ sudo update-rc.d sshd defaults
update-rc.d: /etc/init.d/sshd: file does not exist


what does this mean? Have i really installed ssh server?i can successfully login to localhost by "sudo ssh localhost" .
thanks!
 
Old 03-02-2011, 07:57 AM   #9
Juako
Member
 
Registered: Mar 2010
Posts: 202

Rep: Reputation: 84
Quote:
Originally Posted by wang View Post
one more confusion:
by
Code:
sudo update-rc.d sshd defaults
i got

nuli@nuli-laptop:~$ sudo update-rc.d sshd defaults
update-rc.d: /etc/init.d/sshd: file does not exist
My bad, note in my post that i refer to the debian init.d script as "ssh", except in the update-rc.d example where i mistype it as "sshd". I'll correct the post.

Try
Code:
sudo update-rc.d ssh defaults
I bet it'll work then.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Disable/enable USB storage device @ run time Mr.J Linux - Security 1 09-08-2008 10:16 AM
Disable/enable USB storage device @ run time Mr.J Linux - Kernel 3 08-03-2008 08:14 AM
selectly enable/disable ssh for user.. piyushiitk Linux - Networking 2 05-16-2006 01:06 PM
How to permanently disable/enable boot-up services for fc5 FireGunz Fedora 11 03-30-2006 06:15 PM
disable ssh-timout after some idle time papa_anarchia Linux - General 1 11-25-2005 02:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 05:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration