# Trellis Xilonz backup to FTP

**URL:** https://discourse.roots.io/t/trellis-xilonz-backup-to-ftp/22137
**Category:** trellis
**Created:** 2022-01-20T06:49:41Z
**Posts:** 3

## Post 1 by @tomektomczuk — 2022-01-20T06:49:42Z

Hi, I’m trying to create automatic backup via [Xilonz/trellis-backup-role extension](https://github.com/Xilonz/trellis-backup-role).

I figure out that variables

```
backup_target_user: user
backup_target_pass: password
```

should be placed in all/vault.yml as their were not recognize when in production/vault.yml

I set the target to:  
`target: ftp://{{ backup_target_user }}[:{{ backup_target_pass }}]@xyz.ftp.dhosting.pl[:21]`

and server log shows the error

```
Attempt 1 failed. BackendException: Error running 'lftp -c "source /tmp/duplicity-etq94hg0-tempdir/mkstemp-umg8ffmk-1; ( cd uploads/ && ls ) || ( mkdir -p uploads/ && cd uploads/ && ls )"': returned 1, with output:

open: Not connected
cd: Not connected
mkdir: Not connected
```

I found out that this problem would gone after lftp update → [source](https://answers.launchpad.net/duplicity/+question/694064)

I have also tried NcFTP according to [Duplicity instruction](http://duplicity.nongnu.org/vers8/duplicity.1.html#sect7) changing the target to

`target: ncftp+ftp://{{ backup_target_user }}[:{{ backup_target_pass }}]@xyz.ftp.dhosting.pl[:21]`

```
FTP
ftp[s]://user[:password]@other.host[:port]/some_dir

**NOTE:** use lftp+, ncftp+ prefixes to enforce a specific backend, default is lftp+ftp://...
```

but it’s looks like NcFTP is not installed

```
--- Start running command BKP at 06:15:04.230 ---

/bin/sh: 1: ncftpls: not found

NcFTP not found: Please install NcFTP version 3.1.9 or later

06:15:05.293 Task 'BKP' failed with exit code '27'.

--- Finished state FAILED 'code 27' at 06:15:05.293 - Runtime 00:00:01.062 ---
```

How can I make it work?

---

## Post 2 by @tomektomczuk — 2022-01-20T11:28:43Z

I also have tested sftp.

**default setting (paramiko+sftp://)** gave me an error

```
--- Start running command BKP at 08:00:04.107 ---

BackendException: could not load '/etc/ssh/ssh_config', maybe corrupt?

08:00:05.441 Task 'BKP' failed with exit code '23'.

--- Finished state FAILED 'code 23' at 08:00:05.441 - Runtime 00:00:01.334 ---
```

**pexpect+sftp://** gave me the error

```
--- Start running command BKP at 08:30:04.373 ---
Reading globbing filelist /etc/duply/productionurl_uploads/exclude
Attempt 1 failed. BackendException: Error running 'sftp -oServerAliveInterval=15 -oServerAliveCountMax=2
```

and finally **lftp+sftp://** gave me the same error as on ftp

```
LFTP version is 4.8.4
Reading globbing filelist /etc/duply/productionurl_uploads/exclude
Attempt 1 failed. BackendException: Error running 'lftp -c "source /tmp/duplicity-ypnjdqwe-tempdir/mkstemp-3q46b7l1-1; ( cd backup/productionurl/uploads/ && ls ) || ( mkdir -p backup/productionurl/uploads/ && cd backup/productionurl/uploads/ && ls )"': returned 1, with output:

open: Not connected
cd: Not connected
mkdir: Not connected
```

So neither ftp nor sftp worked for me. I would appreciate help making this work. Thank you.

---

## Post 3 by @ben — 2022-01-21T15:18:08Z

Unlisting since this should be posted on that git repo if anything, which I see you already did

> <https://github.com/Xilonz/trellis-backup-role/issues/39>
>
> so I'm trying to backup to FTP. 
> 
> I added user and password variables to all/v…ault.yml When I had them in production vault I get an error that these variables were not set.
> 
> ```
> backup_target_user: user
> backup_target_pass: password
> ```
> 
> my target is 
> 
> `target: ftp://{{ backup_target_user }}[:{{ backup_target_pass }}]@xyz.ftp.dhosting.pl[:21]`
> 
> When I get to the server logs at var/log/duply/ is see the following error
> 
> ```
> --- Start running command BKP at 19:45:03.879 ---
> LFTP version is 4.8.4
> Reading globbing filelist /etc/duply/marcinkujanek.pl_uploads/exclude
> Attempt 1 failed. BackendException: Error running 'lftp -c "source /tmp/duplicity-etq94hg0-tempdir/mkstemp-umg8ffmk-1; ( cd uploads/ && ls ) || ( mkdir -p uploads/ && cd uploads/ && ls )"': returned 1, with output:
> 
> open: Not connected
> cd: Not connected
> mkdir: Not connected
> 
> 
> Attempt 2 failed. BackendException: Error running 'lftp -c "source /tmp/duplicity-etq94hg0-tempdir/mkstemp-umg8ffmk-1; ( cd uploads/ && ls ) || ( mkdir -p uploads/ && cd uploads/ && ls )"': returned 1, with output:
> 
> open: Not connected
> cd: Not connected
> mkdir: Not connected
> 
> 
> Attempt 3 failed. BackendException: Error running 'lftp -c "source /tmp/duplicity-etq94hg0-tempdir/mkstemp-umg8ffmk-1; ( cd uploads/ && ls ) || ( mkdir -p uploads/ && cd uploads/ && ls )"': returned 1, with output:
> 
> open: Not connected
> cd: Not connected
> mkdir: Not connected
> 
> 
> Attempt 4 failed. BackendException: Error running 'lftp -c "source /tmp/duplicity-etq94hg0-tempdir/mkstemp-umg8ffmk-1; ( cd uploads/ && ls ) || ( mkdir -p uploads/ && cd uploads/ && ls )"': returned 1, with output:
> 
> open: Not connected
> cd: Not connected
> mkdir: Not connected
> 
> 
> Giving up after 5 attempts. BackendException: Error running 'lftp -c "source /tmp/duplicity-etq94hg0-tempdir/mkstemp-umg8ffmk-1; ( cd uploads/ && ls ) || ( mkdir -p uploads/ && cd uploads/ && ls )"': returned 1, with output:
> 
> open: Not connected
> cd: Not connected
> mkdir: Not connected
> 
> 
> 19:47:05.072 Task 'BKP' failed with exit code '50'.
> --- Finished state FAILED 'code 50' at 19:47:05.072 - Runtime 00:02:01.193 ---
> ```
> 
> It's looks like we have to update lftp
> [Solution 1](https://answers.launchpad.net/duplicity/+question/694064)

---

## Post 4 by @ben — 2022-01-21T15:18:11Z



---

## Post 5 by @system — 2022-03-03T06:49:43Z

This topic was automatically closed after 42 days. New replies are no longer allowed.
