Added manual
[autosshd_ALT.git] / autosshd / usr / bin / autossh-conf
blobd0cec63794591bc719f2e158c2ba7577a4b5b727
1 #!/bin/sh
2 # autosshd-conf shell for autosshd that export variables from root to _anyssh user
5 init_autossh(){
6 # Source function library.
7 . /etc/init.d/functions
9 # AutoSSHDaemon configuration
10 SYSCONFIGFILE="/etc/sysconfig/autosshd"
11 SourceIfNotEmpty $SYSCONFIGFILE
12 AUTOSSH_PIDFILE=${PIDFILEDIR}/$(basename $1 .conf).pid
13 AUTOSSH_LOCKFILE=${LOCKFILEDIR}/$(basename $1 .conf).lck
14 AUTOSSH_LOGFILE=/var/lib/autosshd/$(basename $1 .conf).log
15 export AUTOSSH_LOGFILE AUTOSSH_LOCKFILE AUTOSSH_PIDFILE AUTOSSH_LOGLEVEL AUTOSSH_POLL AUTOSSH_GATETIME AUTOSSH_DEBUG
17 VERBOSE=false
20 check_permissions(){
21 AUTOSSH_FILES="$AUTOSSH_LOGFILE" # "$AUTOSSH_LOCKFILE $AUTOSSH_PIDFILE"
22 for var in $AUTOSSH_FILES ; do
23 if [ -w "$var" ] || [ ! -e "$var" ]; then
24 $VERBOSE && is_ok $var
25 else
26 echo "Remove $var file"
27 #sudo rm -f $var
29 done
31 for i in ~/.ssh/id_dsa* ; do
32 if [ $(stat -c "%a" $i)=="600" ]; then
33 is_ok $i
34 else
35 echo "Permissions $(stat -c "%a" $i) for $i are too open."
37 done
40 is_ok(){
41 $VERBOSE && echo "File $1 permission is ok"
44 run_autossh(){
45 autossh $@
48 #Fix for import init function
49 if [ -n "$1" ] ; then
50 init_autossh $1
51 check_permissions
52 shift
53 run_autossh $@