• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 525
  • Last Modified:

Commenting services in init.d

I'm in /etc/init.d  and see a bunch of services (ie: ssh, smb ) etc.

I understand this is where you can start/stop services from starting up when you boot up linux?

Should I do a " vi sshd  "

Then what do I do?  The config is pretty big, not sure what to comment to disable it
Thanks
0
dissolved
Asked:
dissolved
  • 3
  • 3
  • 2
  • +1
3 Solutions
 
marxyCommented:
To disable service loading during boot use

/sbin/chkconfig service_name off

For example,
/sbin/chkconfig sshd off

To enable one,
/sbin/chkconfig sshd on
0
 
dissolvedAuthor Commented:
isnt there a way to do it with inetd.conf?  
0
 
MysidiaCommented:
No, inetd.conf pertains only for services that run through the inetd
superserver: servers that don't run as stand-alone programs

(but are launched each time a client connects to the port that inetd listens on)

You need to either use chkconfig   or take out the symlinks by hand
(using chkconfig is best and easiest)
0
Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

 
marxyCommented:
inetd is very old and deprecated.
Newer systems use xinetd but daemon mode is a preffered way to run sshd.
Trust me. :-)

Nevertheless, You can still use xinetd to run ssh.
You should build a file /etc/xinetd.d/ssh with the following content:

service ssh
{
socket_type = stream
wait = no
user = root
server = /usr/sbin/sshd
port = 22
server_args = -i
# only_from = 127.0.0.0/24
only_from = 199.174.138.171
log_on_failure = ATTEMPT HOST RECORD
}

And must restart the service
/etc/rc.d/init.d/xinetd restart
To disable ssh add line inside {}
disabled=yes
And restart xinetd

P.S.
If your system system still use inetd (like rh6), just comment ssh line in the /etc/inetd.conf
and restart inetd daemon.
killall -HUP inetd

P.P.S.
If you still want to use inetd and xinetd instead of daemon mode and if you use new linux system
you have to run these commands anyway to disable sshd
/etc/init.d/sshd stop
/sbin/chkconfig sshd off
0
 
MysidiaCommented:
Adding entries to *inetd.conf   is done to enable not disable services
the truth is to disable optional services  run by init.d,  chkconfig is used

What running

chkconfig service on/off

does is  change symlinks in subdirectories under /etc/rc.d

Here's how it works in SysV style init which is very popular among Linux distributions now:
when your system boots up, it enters a runlevel.
The default runlevel is specified in /etc/inittab

id:XXX:initdefault:

Current runlevel can be changed with the init command, i.e.
'telinit 0'   or 'init 0'  as root is the same as issuing   shutdown -h now
or '/sbin/halt'...  other runlevels have different special meanings

Where XXX is generally either 5 or 3, the system is set to that default at bootup

/etc/rc.d/rc5.d     corresponds to the services that are stopped or started in runlevel 5
(Graphical mode runlevel)

just as   /etc/rc.d/rc3.d   corresponds to services started/stopped when entering runlevel 3

(Runlevel 0  corresponds to system halt, 6 is reboot, 1 is single user)

Each directory contains symlinks to files in /etc/init.d

if it contains  S01blah,   then  the service 'blah' will be started
the numbers determine the sort order

(Services that other services depend on will have lower numbers)

Then you may see symlinks named things such as K20nfs    or K15sshd,
say in runlevel 1...

The 'K' means kill or stop service  when entering that runlevel

So you use chkconfig to change those symlinks for you... because it's
convenient, and avoid you needing to go through the tedium of editing them
all by hand or figuring out the right number corresponding to the start/stop orders  :)
0
 
dissolvedAuthor Commented:
ah..so services that start up with init...only become active when someone attempts a connection on that port. So init is a listening service?
0
 
MysidiaCommented:

>ah..so services that start up with init...only become active when someone attempts a connection on that port. So >init is a listening service?

Well, replace the word "init" with the word "inetd"  every place where it appears in the
above sentence and it is correct.

Inetd and Init are quite different.  
Init is not a listener or network service

although it manages some system  tasks like login gettys
and starts/stops system service programs

(Inetd is just one service [inetd is a network service])
0
 
manav_mathurCommented:
Init is the proverbial 'grandfather of all' processes. It is the first process that the kernel runs. It is responsible for spawning all other processes
Inetd is your super-server. It manages your network related daemons and listens on many ports. Whenever a reques comes on, lets say telnet port, it spawns the telnet daemon to serve that request.
0
 
dissolvedAuthor Commented:
thanks everyone
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 3
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now