Mercurial > vanilla
view network/openssh/sshd @ 460:b43b5c35f273
vanilla: turn off gtk-update-icon-cache output
author | David Demelier <markand@malikania.fr> |
---|---|
date | Sat, 06 Apr 2019 09:37:16 +0200 |
parents | f2c94d482098 |
children | 9f90de3d806f |
line wrap: on
line source
#!/bin/sh # # /etc/rc.d/sshd: run control script for sshd if [ -f /etc/rc.conf ]; then source /etc/rc.conf fi : ${SSHD_CMD:=/usr/sbin/sshd} : ${SSHD_ARGS:=} : ${SSHD_PID:=/var/run/sshd.pid} sshd_start() { if [ ! -f /etc/ssh/ssh_host_rsa_key ]; then /usr/bin/ssh-keygen -q -t rsa -b 2048 -N "" -f /etc/ssh/ssh_host_rsa_key fi if [ ! -f /etc/ssh/ssh_host_dsa_key ]; then /usr/bin/ssh-keygen -q -t dsa -N "" -f /etc/ssh/ssh_host_dsa_key fi if [ ! -f /etc/ssh/ssh_host_ecdsa_key ]; then /usr/bin/ssh-keygen -q -t ecdsa -b 521 -N "" -f /etc/ssh/ssh_host_ecdsa_key fi if [ ! -f /etc/ssh/ssh_host_ed25519_key ]; then /usr/bin/ssh-keygen -q -t ed25519 -N "" -f /etc/ssh/ssh_host_ed25519_key fi echo "Starting sshd: $SSHD_CMD $SSHD_ARGS" $SSHD_CMD $SSHD_ARGS -p $SSHD_PID } sshd_status() { if [ -s $SSHD_PID ]; then echo "sshd is running with pid: `cat $SSHD_PID`" else echo "sshd is not running" fi } sshd_stop() { if [ -s $SSHD_PID ]; then echo "Stopping sshd..." kill -QUIT $SSHD_PID fi } sshd_restart() { sshd_stop sleep 3 sshd_start } case $1 in start) sshd_start ;; status) sshd_status ;; stop) sshd_stop ;; restart) sshd_restart ;; *) echo "usage: $(basename $0) restart|start|status|stop" ;; esac