Admin backup issue

Djunity

Verified User
Joined
Mar 9, 2008
Messages
243
Location
Holland
Hi All,

For the past 4 days the admin backups fail during the nightly backups on one of or servers.

Where getting an ncftpput server said permission denied on the /home/tmp directory

I have allready tryd to set all right correctly using /usr/local/directadmin/scripts/ set_permissions user_homes and da_confs.
I have compared the right with another server and the rights of /home/tmp is correct root and 1777.

What else could cause this error im kinda in the dark right now.
 
im not having troubles adding the backup command to the datasq when its running the backup job its failling

this is what im getting in the message system
ncftpput /home/tmp/admin/admin.admin.admin.tar.gz: server said: admin.admin.admin.tar.gz: Permission denied
 
Then its a read permission problem. You would have to check what permissions its creating the file as and why it cant read it.
 
permissions on the dirs are 700 thats ok compared that with another server and file 644 thats the same to also uid gid are the same as on the other server thats my problem i can seem to point it where it goes wrong
 
Hello,

We can edit the ftp_upload.php script to add a few lines for debugging, eg edit:
Code:
/usr/local/directadmin/scripts/ftp_upload.php
and make it look something like this:
Code:
/bin/shFTPPUT=/usr/bin/ncftpput
TOUCH=/bin/touch
PORT=${ftp_port}


if [ ! -e $TOUCH ] && [ -e /usr/bin/touch ]; then
        TOUCH=/usr/bin/touch
fi


if [ ! -e $FTPPUT ]; then
        echo "";
        echo "*** Backup not uploaded ***";
        echo "Please install $FTPPUT by running:";
        echo "";
        echo "cd /usr/local/directadmin/scripts";
        echo "./ncftp.sh";
        echo "";
        exit 10;
fi


if [ ! -e "${ftp_local_file}" ]; then
        echo "Cannot find backup file ${ftp_local_file} to upload";
        exit 11;
fi

[COLOR=#0000ff]id
ls -la ${ftp_local_file}
ls -la /home/tmp[/COLOR]


CFG=${ftp_local_file}.cfg
/bin/rm -f $CFG
$TOUCH $CFG
/bin/chmod 600 $CFG
/bin/echo "host $ftp_ip" >> $CFG
/bin/echo "user $ftp_username" >> $CFG
/bin/echo "pass $ftp_password" >> $CFG


if [ ! -s ${CFG} ]; then
        echo "${CFG} is empty. ncftpput is not going to be happy about it.";
        ls -la ${CFG}
        ls -la ${ftp_local_file}
        df -h
fi


$FTPPUT -f $CFG -V -t 25 -P $PORT -m "$ftp_path" "$ftp_local_file" 2>&1
RET=$?


/bin/rm -f $CFG


exit $RET
Where the blue lines are new.

It should give us a better picture of the permissions on the file, containing folder, and what uid/gid are being run when the call is made.

John
 
uid=496(diradmin) gid=495(diradmin) groups=495(diradmin)
-rw-r----- 1 diradmin admin 76472 May 3 17:10 /home/tmp/admin/admin.admin.admin.tar.gz
total 12
drwxrwxrwt. 3 root root 4096 May 3 17:10 .
drwx--x--x. 56 root root 4096 Apr 19 18:15 ..
drwx--x--x 2 diradmin diradmin 4096 May 3 17:10 admin
ncftpput /home/tmp/admin/admin.admin.admin.tar.gz: server said: admin.admin.admin.tar.gz: Permission denied

is the out put of the message inside direct admin now
 
ncftpput /home/tmp/admin/admin.admin.admin.tar.gz: server said: admin.admin.admin.tar.gz: Permission denied
You can't upload to /home/tmp/admin, that's the reason you got a permission denied.
Adjust your backup settings, set it to upload to just /admin_backups without anything else in front of it, and you shoud be fine.
Or make a /home/admin/tmp directory and upload to there, that should also work.
 
Should not be a problem this is what direct admin itself does when it runs the admin backups and it does work on all of or other server exacly the same.

It is defined in the directadmin.conf: tmpdir=../../../home/tmp this is from default install same on all servers
 
I don't understand.
It's correct that the tmpdir is setup default on all servers but that is for local use, this does not mean admin also have ftp access to it remotely. Or am I mistaken?

When you make a backup, before transferring to the remote server, DA puts the backup in /home/tmp/admin, but that is on the local server.
From there ncftpput takes over and transfers the file.
What username and hostname is DA using then to transfer the backups? Because I just tested with admin username and pass, using ftp.mydomainname.nl and also tried with hostname.mydomainname.nl it won't work.
 
Da creates the admin dir inside /home/tmp when it runs the backup procces and after words it gets removed when the backup is completed.

Its no ftp login issue that fine it really is a local issue but no idea why and what is diffrent then on the other servers.
 
Its no ftp login issue
Well I don't understand because ncftpput is an ftp program, and that's were the error occurs.
So I hope you're right and will find the solution.
 
Code:
uid=496(diradmin) gid=495(diradmin) groups=495(diradmin)
-rw-r----- 1 diradmin admin 76472 May  3 17:10 /home/tmp/admin/admin.admin.admin.tar.gz
total 12
drwxrwxrwt.  3 root     root     4096 May  3 17:10 .
drwx--x--x. 56 root     root     4096 Apr 19 18:15 ..
drwx--x--x   2 diradmin diradmin 4096 May  3 17:10 admin
ncftpput /home/tmp/admin/admin.admin.admin.tar.gz: server said: admin.admin.admin.tar.gz: Permission denied
Well.. that doesn't make much sense...

Unless /home is set to something strange... it should be set to 711.
That's my last guess, as all the permissions look correct.

The paths values also look fine, in case there was any confusion there.

Edit: Maybe add another
Code:
[COLOR=#0000FF]ls -la ${ftp_local_file}[/COLOR]
just before the exit $RET, just to make sure it didn't change right before the upload (which would be strange, but we should check anyway)

John
 
Unless /home is set to something strange... it should be set to 711.
That's my last guess, as all the permissions look correct.

/home/tmp should not be 711 but 777 by default its set as 1777 else youll get an error right on adding the backup job aka
/sh: line 51: /home/tmp/4429.dump: Permission denied
/usr/bin/ncftpls returned error code 1
FTP information invalid.

After adding that extra line before exit; the messagen is
Backup van gebruiker admin is voltooid. <8:55:02>
uid=496(diradmin) gid=495(diradmin) groups=495(diradmin)
-rw-r----- 1 diradmin admin 76550 May 4 08:55 /home/tmp/admin/admin.admin.admin.tar.gz
total 12
drwxrwxrwt. 3 root root 4096 May 4 08:55 .
drwx--x--x. 56 root root 4096 Apr 19 18:15 ..
drwx--x--x 2 diradmin diradmin 4096 May 4 08:55 admin
ncftpput /home/tmp/admin/admin.admin.admin.tar.gz: server said: admin.admin.admin.tar.gz: Permission denied
-rw-r----- 1 diradmin admin 76550 May 4 08:55 /home/tmp/admin/admin.admin.admin.tar.gz
<8:55:02>
 
/home/tmp should not be 711 but 777 by default its set as 1777 else youll get an error right on adding the backup job aka
You misunderstood. DA support said that /home should be 711 and that is correct.
It's also correct that /home/tmp should be 1777.
 
Oh, I believe I've missed a very important piece of information in your log output.

The part I missed:
Code:
s[COLOR=#333333][I]erver said:[/I]
so the permission denied is actually on the ftp server side of things. It's not a local issue.

It's probably a permission or ownership issue on the server server.
Try uploading a file manually, and check the ftp logs on the other end.
Ensure the ftp account has write permissions on it's ftp path.

John[/COLOR]
 
Oh, I believe I've missed a very important piece of information in your log output.

The part I missed:
Code:
s[COLOR=#333333][I]erver said:[/I]
so the permission denied is actually on the ftp server side of things. It's not a local issue.

It's probably a permission or ownership issue on the server server.
Try uploading a file manually, and check the ftp logs on the other end.
Ensure the ftp account has write permissions on it's ftp path.

John[/COLOR]

Hi John,

Thanks, and indeed your right after looking in to every thing the problem was that there where allready existing backup files that where created true the backup system only not true ftp but nsftp and the uid and gid where unknown for the ftp server.
 
Back
Top