Servicios y Demonios
Mantener la seguridad de su sistema es extremadamente importante y una forma de acercarse a esta tarea es administrar el acceso a los servicios del sistema cuidadosamente. Su sistema puede que necesite suministrar acceso abierto a servicios concretos (por ejempo, httpd
si está ejecutando un servidor web). Sin embargo, si no necesita suministrar un servicio usted debería quitarlo para minimizar la exposición a posibles aprovechamientos de errores.
Este capítulo cubre la configuración de los servicios a ser ejecutados cuando se arranca el sistema y suministra información sobre como arrancar, parar y reiniciar los servicios desde a línea de comandos usando la utilidad systemctl.
Mantener el sistema seguro
Cuando usted permite acceso para nuevos servicios, recuerde que siempre que tanto el cortafuegos como SELinux necesitan ser configurados también. Uno de los errores mas comunes que se cometen cuando se configura un nuevo servicio es el descuido en implementar la necesaria configuración de cortafuegos y de políticas de SELinux para permitir su acceso. Para más información vea Fedora 26 Guía de Seguridad. |
Configurando Servicios
Para permitirle configurar que servicios son iniciados en el momento del arranque, Fedora lleva inegrada la herramienta en línea de comandos systemctl.
No utilice las utilidades ntsysv y chkconfig
Aunque todavía es posible usar las utilidades ntsysv y chkconfig para administrar servicios que tengan instalados scripts de inicio en el directorio |
Habilitar el servicio irqbalance
Para asegurar un rendimiento óptimo de la arquitectura de ALIMENTACIÓN se recomienda habilitar el servicio systemctl status irqbalance.service
|
Habilitar el Servicio
Para configurar que un servicio se inicie automáticamente en el momento del arranque, use el comando systemctl en el siguiente formato:
systemctl enable service_name.service
El servicio se iniciará la siguiente vez que arranque el sistema. Para información sobre como iniciar el servicio inmediatamente, vea Correr el Servicio.
Imagine que desea correr el Servidor Apache HTTP en su sistema. Siempre que tenga instalado el paquete httpd usted puede habilitar el servicio httpd
tecleando lo siguiente en el indicador de shell como root
:
~]# systemctl enable httpd.service
Deshabilitar el Servicio
Para deshabilitar el inicio de un servicio en el momento del arranque, use el comando systemctl en la siguiente forma:
systemctl disable service_name.service
La próxima vez que usted arranque el sistema el servicio no se iniciará. Para información sobre como para el servicio inmediatamente vea Para el Servicio.
Con el objetivo de asegurar el sistema se advierte a los usuarios para que deshabiliten los protocolos de conexión no seguros como Telnet. Se puede asegurar de que e servicio telnet
está deshabilitado corriendo el siguiente comando como root
:
~]# systemctl disable telnet.service
Correr Servicios
La utilidad systemctl le permite también determinar el estado de un servicio concreto, así como iniciar, parar o reiniciar un servicio.
No utilice la utilidad service
Aunque todavía es posible utilizar la utilidad service para administrar servicios que tengan scripts de inicio instalados en el directorio |
Comprobar el Estado del Servicio
Para determinar el estado de un servicio concreto, use el comando systemctl de la siguiente forma:
systemctl status service_name.service
Este comando proporciona información detalladas sobre el estado del servicio. Sin embargo, si solo necesita verificar que el servicio está corriendo puede usar en su lugar el comando systemctl de la siguiente forma:
systemctl is-active service_name.service
Enabling the httpd service illustrated how to enable starting the httpd
service at boot time. Imagine that the system has been restarted and you need to verify that the service is really running. You can do so by typing the following at a shell prompt:
~]$ systemctl is-active httpd.service
active
You can also display detailed information about the service by running the following command:
~]$ systemctl status httpd.service httpd.service - LSB: start and stop Apache HTTP Server Loaded: loaded (/etc/rc.d/init.d/httpd) Active: active (running) since Mon, 23 May 2011 21:38:57 +0200; 27s ago Process: 2997 ExecStart=/etc/rc.d/init.d/httpd start (code=exited, status=0/SUCCESS) Main PID: 3002 (httpd) CGroup: name=systemd:/system/httpd.service ├ 3002 /usr/sbin/httpd ├ 3004 /usr/sbin/httpd ├ 3005 /usr/sbin/httpd ├ 3006 /usr/sbin/httpd ├ 3007 /usr/sbin/httpd ├ 3008 /usr/sbin/httpd ├ 3009 /usr/sbin/httpd ├ 3010 /usr/sbin/httpd └ 3011 /usr/sbin/httpd
To display a list of all active system services, use the following command:
systemctl list-units --type=service
This command provides a tabular output with each line consisting of the following columns:
-
UNIT
— Asystemd
unit name. In this case, a service name. -
LOAD
— Information whether thesystemd
unit was properly loaded. -
ACTIVE
— A high-level unit activation state. -
SUB
— A low-level unit activation state. -
JOB
— A pending job for the unit. -
DESCRIPTION
— A brief description of the unit.
You can list all active services by using the following command:
~]$ systemctl list-units --type=service
UNIT LOAD ACTIVE SUB JOB DESCRIPTION
abrt-ccpp.service loaded active exited LSB: Installs coredump handler which saves segfault data
abrt-oops.service loaded active running LSB: Watches system log for oops messages, creates ABRT dump directories for each oops
abrtd.service loaded active running ABRT Automated Bug Reporting Tool
accounts-daemon.service loaded active running Accounts Service
atd.service loaded active running Job spooling tools
[output truncated]
In the example above, the abrtd
service is loaded, active, and running, and it does not have any pending jobs.
Running the Service
To run a service, use the systemctl command in the following form:
systemctl start service_name.service
This will start the service in the current session. To configure the service to be started at boot time, refer to Enabling the Service.
Enabling the httpd service illustrated how to run the httpd
service at boot time. You can start the service immediately by typing the following at a shell prompt as root
:
~]# systemctl start httpd.service
Stopping the Service
To stop a service, use the systemctl command in the following form:
systemctl stop service_name.service
This will stop the service in the current session. To disable starting the service at boot time, refer to Enabling the Service.
Disabling the telnet service illustrated how to disable starting the telnet
service at boot time. You can stop the service immediately by running the following command as root
:
~]# systemctl stop telnet.service
Restarting the Service
To restart a service, use the systemctl command in the following form:
systemctl restart service_name.service
For any changes in the /etc/ssh/sshd_config
configuration file to take effect, it is required that you restart the sshd
service. You can do so by typing the following at a shell prompt as root
:
~]# systemctl restart sshd.service
Want to help? Learn how to contribute to Fedora Docs ›