systemctl Il comando viene utilizzato su RedHat 7 Linux per gestire i servizi a livello di sistema. Consente agli amministratori di gestire il servizio ssh per avviare, riavviare, interrompere o abilitare il caricamento automatico dopo l'avvio del sistema.
Nell'installazione del servizio ssh sul tuo Linux RHEL 7, esegui il seguente comando linux:
# yum install openssh
Tramite servizio SSH predefinito o per essere più precisi sshd ( demone ) è disabilitato. Una volta installato il pacchetto opensshd, puoi controllare lo stato del servizio SSHD utilizzando il comando seguente:
# systemctl status sshd sshd.service - OpenSSH server daemon Loaded: loaded (/usr/lib/systemd/system/sshd.service; disabled) Active: inactive (dead)
Per avviare il demone ssh (sshd) su RHEL 7, esegui:
systemctl start sshd
Dopo aver avviato correttamente il demone SSHD, controlla lo stato del servizio sshd tramite:
# systemctl status sshd
sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; disabled)
Active: active (running) since Mon 2014-09-01 09:35:17 EST; 2s ago
Process: 6191 ExecStartPre=/usr/sbin/sshd-keygen (code=exited, status=0/SUCCESS)
Main PID: 6194 (sshd)
CGroup: /system.slice/sshd.service
└─6194 /usr/sbin/sshd -D
Sep 01 09:35:17 localhost.localdomain systemd[1]: Started OpenSSH server daemon.
Sep 01 09:35:17 localhost.localdomain sshd[6194]: Server listening on 0.0.0.0 port 22.
Sep 01 09:35:17 localhost.localdomain sshd[6194]: Server listening on :: port 22.
Successivamente, al riavvio del tuo box Linux RHEL 7 dovrai riavviare manualmente il servizio ssh. Per avviare sshd service automaticamente dopo il riavvio, inserisci il seguente comando linux nel tuo terminale:
# systemctl enable sshd ln -s '/usr/lib/systemd/system/sshd.service' '/etc/systemd/system/multi-user.target.wants/sshd.service'
Per disabilitare sshd sul tuo sistema Linux RHEL 7 modifica il comando precedente in:
# systemctl disable sshd rm '/etc/systemd/system/multi-user.target.wants/sshd.service'