If you ever want to either conserve resources or secure a machine by reducing the number of services you don’t need, here are simple commands that can help you to do just that:
1. List services:
/usr/bin/svcs -a
For services with the status of ” legacy_run”, you will need to run scripts in /etc/init.d
and /etc/rc*.d
directories. For example:
/etc/init.d/apache stop
2. Disable services you don’t need with example commands below:
/usr/sbin/svcadm disable svc:/network/finger:default /usr/sbin/svcadm disable svc:/network/login:rlogin /usr/sbin/svcadm disable svc:/network/shell:default /usr/sbin/svcadm disable svc:/network/smtp:sendmail /usr/sbin/svcadm disable svc:/network/rpc/rstat:default /usr/sbin/svcadm disable svc:/network/rpc/rusers:default /usr/sbin/svcadm disable svc:/network/ftp:default /usr/sbin/svcadm disable svc:/network/nfs/rquota:default /usr/sbin/svcadm disable svc:/network/nfs/client:default /usr/sbin/svcadm disable svc:/network/nfs/nlockmgr:default /usr/sbin/svcadm disable svc:/network/nfs/mapid:default /usr/sbin/svcadm disable svc:/network/nfs/status:default /usr/sbin/svcadm disable svc:/network/nfs/cbd:default
Does this disable services across reboots or do we have to create a script to disable them on each reboot?
If you want to temporarily disable a service, add a
-t
option to the disable sub-command. Base on this information, I expect that the disable sub-command persist across reboots. See man page for more information.