Submitted by arjones85 on Fri, 10/23/2009 - 19:52
I have created a scheduled backup to upload over SSH. I have the following string as the destination file: /backup/%Y-%m-%d
However, even though "Create destination directory" is checked, it still fails:
Uploading archive to SSH server .. .. upload failed! Password: scp: /backup/2009-10-23: No such file or directory
These exact settings, when set to backup to the same location and username/password over regular FTP instead, works without a problem.
I have verified this is not a server-side issue by manually logging in with Filezilla over SFTP and being able to create the directory manually.
Status:
Closed (fixed)
Comments
Submitted by JamieCameron on Sat, 10/24/2009 - 00:14 Comment #1
Which backup file format did you select? If you are backing up to a directory, make sure you select "One file per domain".
Also, did that /backup/YYYY-mm-dd directory actually get created on the server?
Submitted by arjones85 on Sat, 10/24/2009 - 13:55 Comment #2
I selected "One file per server", and the directory does NOT get created when "SSH server" is selected, but does get created if "FTP server" is selected. No other settings at all change between the two except for FTP or SSH.
Submitted by JamieCameron on Sat, 10/24/2009 - 16:31 Comment #3
Does the remote SSH user perhaps have his shell set to scponly, or something that would prevent Virtualmin from SSHing in and running mkdir ?
Submitted by arjones85 on Sat, 10/24/2009 - 19:01 Comment #4
No, I can SSH in using regular putty without an issue:
login as: [replaced username]
Using keyboard-interactive authentication.
Password:
Copyright (c) 1980, 1983, 1986, 1988, 1990, 1991, 1993, 1994
FreeBSD 7.1-RELEASE-p2 (BACKUP16) #0: Sat May 30 21:36:24 UTC 2009
$ echo $SHELL
/bin/sh
$ mkdir testdir
$ ls
backup keys testdir
$ rm -r testdir
$ ls
backup keys
$
By the way, that backup dir there is due to me setting it to regular FTP only for now until we get this sorted out =)
Submitted by JamieCameron on Sun, 10/25/2009 - 22:30 Comment #5
Ok .. so if you backup via SSH to a fixed directory (not using data substitutions), does it create the directory successfully?
Submitted by arjones85 on Sun, 10/25/2009 - 23:32 Comment #6
Unfortunately not. The error shown is:
Uploading archive to SSH server .. .. upload failed! Password: scp: /backup: Permission denied
Here are my settings:
http://dl.getdropbox.com/u/170406/pics/puttysettings.jpg
http://dl.getdropbox.com/u/170406/pics/settings.jpg
It did create the backup directory this time (no idea why), however no files were uploaded to it:
$ ls
backup keys
$
$ cd backup
$ ls
$
The permissions for the folder "backup" are correct:
$ ls -l
total 4
drwxr-xr-x 2 user user 512 Oct 26 04:31 backup
drwx------ 2 user user 512 Oct 23 23:44 keys
$
Submitted by JamieCameron on Mon, 10/26/2009 - 13:50 Comment #7
That's really odd .. if you run the backup again when the /backup directory exists, does it still fail?
Submitted by arjones85 on Mon, 10/26/2009 - 13:52 Comment #8
Yes, it still fails with the same error:
Creating backup for virtual server example.com ..
scp: /backup: Permission denied Killed by signal 1.
Submitted by JamieCameron on Mon, 10/26/2009 - 15:02 Comment #9
Wait .. that "permission denied" error means that the SSH password was incorrect. Check the password field on the backup form..
Submitted by arjones85 on Mon, 10/26/2009 - 19:25 Comment #10
I guarantee you that password is correct. The password is very simple to type.
Just to double check, I typed it into notepad, copied it into putty to login with it, and then copied it into the Virtualmin password field and the backup still failed. The username is correct as well.
Uploading archive to SSH server .. .. upload failed! Password: scp: /backup: Permission denied
Just to make sure this wasn't some sort of SCP server weirdness, I downloaded WinSCP and connected using the SCP protocol, and was able to create a directory using WinSCP without a problem.
Are you sure that the password form is passing the password I type in to the server correctly?
Submitted by JamieCameron on Tue, 10/27/2009 - 13:57 Comment #11
Does the password perhaps contain any odd characters like : or @ ?
Also, if you have access to the logs on the SSH server, what gets logged to /var/log/messages and /var/log/secure or /var/log/auth.log when you try to backup?
Submitted by arjones85 on Tue, 10/27/2009 - 14:04 Comment #12
Hello,
The password does not contain any odd characters, it is only letters and numbers. Unfortunately I do not have access to the logs on the backup server as it is just a standard backup account purchased from serverorigin.
Submitted by arjones85 on Tue, 10/27/2009 - 23:25 Comment #13
I am trying to get a copy of the exact error that is being logged on the server from ServerOrigin. I will try to get that to you as soon as they provide it.
Submitted by JamieCameron on Tue, 10/27/2009 - 23:29 Comment #14
Ok, thanks..
So does ServerOrigin offer some kind of SSH backup service?
Submitted by arjones85 on Wed, 10/28/2009 - 08:11 Comment #15
Hello,
Yes, they offer (fairly cheap!) backup space over FTP and SCP/SFTP (http://www.serverorigin.com/backup.php). This is their response:
Russell, Sadly, SSH logs are not very detailed. Can you provide the full error you are receiving? We can help track it further on our end as well.
Thanks
I have provided them all of the information I gave you (as well as let them know that you are involved in troubleshooting so that perhaps they take it more seriously). I really don't understand. I am willing to change my password on serverorigin to a temporary one and see if maybe you can establish a connection on your end with your own copy of Virtualmin if you would like. That would at least let us know if the problem is a "global" issue with perhaps ServerOrigin's setup or Virtualmin itself, or if its just an issue with my individual installation.
Submitted by JamieCameron on Wed, 10/28/2009 - 11:36 Comment #16
Sure, if I could try a test backup to the same destination you are using, that would be very useful. It may be that there is something different in the way their SSH server works which confuses Virtualmin, as I've only tested it against regular Linux systems.
You could email me a test login and password at jcameron@virtualmin.com
Submitted by arjones85 on Wed, 10/28/2009 - 20:14 Comment #17
Got it figured out!
Looks like the problem was the / in front of the backup directory. FTP jails you to your home directory, so as far as the FTP server is concerned /backup really is /backup. However with SSH, it doesn't jail you in your home directory so when it was attempting to upload to /backup, it was trying to upload literally to the path /backup.
Taking the / out from in front of it fixed the situation!
Doh!
Submitted by JamieCameron on Wed, 10/28/2009 - 23:46 Comment #18
Ah .. that would explain it! Alternatively, you could have entered /home/whatever/backup as the directory.
Submitted by arjones85 on Thu, 10/29/2009 - 01:26 Comment #19
Yep... but I'm still having weirdness.
Unfortunately it is uploading now, but isn't actually uploading into a directory. It makes the "backup" directory and then for some reason uploads everything into a giant file called 2009-10-28 instead of making the folder and uploading the individual .tar.gz's like normal! Like before, FTP works fine, its just SSH having problems.
I have tried adding a trailing / at the end, but Virtualmin strips that last / off when I click save. I have also tried backup/%Y-%m-%d as the path and /usr/home/username/backup/%Y-%m-%d to no avail, both create a big file instead of a directory.
The only way it uploads correctly, is if I disable the date substitutions, IE, only upload into a folder called "backup".
Submitted by arjones85 on Thu, 10/29/2009 - 01:27 Comment #20
Submitted by JamieCameron on Thu, 10/29/2009 - 11:49 Comment #21
Did you select "One file per domain" as the backup format?
Also, you should enter the full path like /usr/home/username/backup/%Y-%m-%d ..
Submitted by arjones85 on Thu, 10/29/2009 - 14:32 Comment #22
Yes, it's at one file per server, and the full path is in there. It still drops it as a single large unreadable file with the name of the file as the date. Very strange.
I have emailed you login information for both the Virtualmin server and the backup account. I cleaned out the backup account so its completely clean.
Submitted by JamieCameron on Thu, 10/29/2009 - 23:28 Comment #23
Thanks for the login .. I am checking it out now.
Submitted by JamieCameron on Thu, 10/29/2009 - 23:39 Comment #24
Ok, I just tried a couple of backups .. and they seemed to work fine. The destination directory was created, and the expected files put into it.
This was done from within Virtualmin, at Scheduled Backups -> Backup..
Submitted by arjones85 on Fri, 10/30/2009 - 00:01 Comment #25
I don't understand how yours is working but mine isn't.
I went to scheduled backups - backup - backup now. Here are the results:
Putty window:
$ ls
keys
[The Virtualmin backup finished]
$ ls
backup keys
$ cd backup
$ ls
2009-10-29
$ cd 2009-10-29
cd: can't cd to 2009-10-29
$
Virtualmin window:
Starting backup of 1 domains to /usr/home/user/backup/2009-10-29 on SSH server backup.serverorigin.com ..
Creating backup for virtual server example.com ..
Backing up Virtualmin settings (Module configuration, Server templates, New mailbox email messages, Custom fields, links and shells, Scheduled Virtualmin backups, FTP directory restrictions) .. .. done
Uploading archive to SSH server .. .. done
1 servers backed up successfully, 0 had errors. 6 Virtualmin configuration settings backed up successfully.
Backup is complete. Final size was 6.43 MB.
I don't understand. I tried both "Backup Now" and "Backup in background". Both supposedly completely correctly but I cannot cd into that directory.
What did you do differently?
Submitted by arjones85 on Fri, 10/30/2009 - 00:07 Comment #26
Ah...... I got it....
I assumed that since "make destination directory" was checked, it would make all of the directories that were missing. Once I manually made the "backup" directory, the "date" directory is being made correctly now. That's what was causing the weirdness, it would make the backup directory but not the final destination directory.
Woops again. Leave it to someone to find a way to break it eh?
Thanks for your help, you've been very patient!
Submitted by JamieCameron on Fri, 10/30/2009 - 13:13 Comment #27
Ok, that would explain it .. if the parent dir doesn't exist, odd things could happen.
Sadly there is no reliable way to create directories recursively via scp :-(
Submitted by Issues on Sat, 11/14/2009 - 03:21 Comment #28
Automatically closed -- issue fixed for 2 weeks with no activity.