# cat /etc/ssh/sshd_config # cat /etc/rsyslog.conf # ls /etc/rsyslog.d/ # cat /etc/apache2/apache2.conf # ls /etc/apache2/sites-available/ # ls -l /etc/apache2/sites-enabled/
# /usr/sbin/sshd
$ ps -p 1
# cat /etc/rc.local
#!/bin/sh /usr/bin/ssh -N -R 61000+X:localhost:22 -o ServerAliveInterval=60 -o ExitOnForwardFailure=yes userX@gate.isp.un & exit 0
chmod +x /etc/rc.local
# cat /etc/default/proftpd # cat /etc/init.d/proftpd # /etc/init.d/proftpd start # /etc/init.d/proftpd stop # cat /etc/init.d/sshvpn
#!/bin/sh ######### CentOS ########## # sshvpn Start/Stop the sshvpn daemon. # # chkconfig: 2345 90 60 ######### Debian ########## ### BEGIN INIT INFO # Provides: sshvpn # Required-Start: $remote_fs $syslog $local_fs $network # Required-Stop: $remote_fs $syslog $local_fs $network # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: sshvpn Secure Shell server ### END INIT INFO if [ "$1" = start ] then echo Starting sshvpn... /usr/bin/ssh -N -R 61000+X:localhost:22 -o ServerAliveInterval=60 -o ExitOnForwardFailure=yes userX@gate.isp.un & echo $! > /var/run/sshvpn.pid elif [ "$1" = stop ] then echo Stopping sshvpn... kill -TERM `cat /var/run/sshvpn.pid` rm /var/run/sshvpn.pid else echo Usage: echo '/etc/init.d/sshvpn start|stop' fi
# runlevel # cd /etc/init.d # ln -s ../init.d/sshvpn /etc/rc5.d/S20sshvpn # ln -s ../init.d/sshvpn /etc/rc0.d/K20sshvpn # ln -s ../init.d/sshvpn /etc/rc6.d/K20sshvpn
# ls -l /etc/rc?.d/* | grep ftp # update-rc.d -f proftpd remove # update-rc.d proftpd defaults
http://www.cyberciti.biz/faq/rhel5-update-rcd-command/
# chkconfig --list # chkconfig --add sshvpn # chkconfig --list sshvpn # chkconfig --del sshvpn
# cat /etc/init.d/asterisk
... MAXFILES=65536 ...
$ systemctl -a $ systemctl list-units centos# find /usr/lib/systemd/system/ debian# find /lib/systemd/system/ # find /etc/default/ $ systemctl status ssh # systemctl stop ssh # systemctl start ssh # systemctl reload ssh # systemctl disable ssh # systemctl enable ssh # cat /etc/systemd/system/sshvpn.service
[Unit] Description=ssh client vpn daemon After=network.target [Service] ExecStart=/usr/bin/ssh -N -R 61000+X:localhost:22 -o ServerAliveInterval=60 -o ExitOnForwardFailure=yes userX@gate.isp.un #ExecStart=/usr/bin/java -jar /home/jenkins/agent.jar -url http://server.corp13.un:8081/ -secret NNNNNNNNNNNNNNNNNNNN -name gate -workDir "/home/jenkins/" #User=jenkins KillMode=process Restart=always RestartSec=42s [Install] WantedBy=multi-user.target
# systemctl status sshvpn # systemctl enable sshvpn # systemctl start sshvpn
# systemctl edit имясервиса
[Service] LimitNOFILE=65536 # nginx TimeoutStartSec=180 # elasticsearch
# systemctl daemon-reload # не очевидно, что нужно # systemctl show имясервиса # systemctl restart имясервиса # systemctl status имясервиса # cat /proc/NNNNN/limits
# ls /etc/init.d/ # /etc/init.d/sshd status|start|stop # rc-service sshd status|start|stop # rc-update add|del sshd default # rc-update show # openrc
# initctl show-config | grep ssh # initctl show-config ssh # less /etc/default/ssh # less /etc/init/ssh.conf # start ssh # stop ssh # initctl list
server# cat /etc/init/sshvpn.conf
description "OpenSSH tunnel" start on filesystem or runlevel [2345] stop on runlevel [!2345] respawn respawn limit 10 5 umask 022 exec /usr/bin/ssh ssh -N -R 192.168.X.10:3389:192.168.100+X.101:3389 student@server.corpX.un
mail# cat /etc/init/communigate.conf
description "Communigate" start on filesystem or runlevel [2345] stop on runlevel [!2345] respawn respawn limit 10 5 umask 022 exec /root/CGateProSoftware/CommuniGate/CGServer-static --Base /var/CommuniGate
server# echo manual > /etc/init/sshvpn.override
debian# service --status-all # service ssh start # service ssh stop