ssh bash script No such file or directory
I am trying to run a script from /var/www/backups/scripts and when i try tell it to zip up a file i get the below error,
I can confirm that /var/www is the home dir and that the scripts work when ran manually though putty but just not though a script.
I'm using the below code to run the zip
#!/bin/bash
unset PATH
#USER VARS
HOMEDIR=~/
BACKUP_TARG_DIR=~/sites/backups/auto
BACKUP_TEMP_NAME=tempBackupFile.tar
BACKUP_TARG_FILE=/var/www/back
DATE=`/bin/date '+%Y-%m-%d'`
echo `/bin/pwd`;
tar -zcvf test.rar /var/www/backups/scripts/tryThis
#cd /var/www
#scp "tempBackupFile.tar" 217.41.51.14:~/testfile.rar;
#tar -zcvf $BACKUP_TEMP_NAME $BACKUP_TARG_FILE;
echo "SITE-"$DATE;
开发者_Python百科below is the output i get
/var/www/backups/scripts
./autoBackup.bash: line 18: tar: No such file or directory
SITE-2011-09-05
Any one have any ideas as this is killing me, all I can think of is its something to do with where the bash script is being run from.
Why do you unset PATH
?? No wonder bash cannot execute tar
.
Check your /etc/ssh/sshd_config
to make sure that you don't have a chroot
directory set. If you do, you will need to either create a bin directory in the chroot
directory and either copy or link the necessary binaries into that directory.
Or you could always comment that line out in the config.
Either way, restart sshd and test.
精彩评论