I can't back up to an external hard drive

I have Duplicati running on a Ubuntu server. I configured a backup to write to an external hard drive, but it always gives me “access denied” errors. The drive is owned by root and its permissions are set to 755 and don’t seem to be changeable even with a “sudo” command. To see what user it was running as, I used this command:
ps aux | grep duplicati

The output was:
swadams 170171 0.0 0.2 151300 38548 ? Sl Aug22 0:00 Duplicati /usr/lib/duplicati/Duplicati.GUI.TrayIcon.exe
swadams 170176 0.0 1.2 2437880 200820 ? Sl Aug22 3:14 /usr/bin/mono-sgen /usr/lib/duplicati/Duplicati.GUI.TrayIcon.exe
root 429542 0.0 0.2 151644 39456 ? SNsl 17:03 0:00 DuplicatiServer /usr/lib/duplicati/Duplicati.Server.exe --webservice-interface=any --webservice-port=8200 --portable-mode
root 429546 0.0 0.3 1113380 64248 ? SNl 17:03 0:01 /usr/bin/mono-sgen /usr/lib/duplicati/Duplicati.Server.exe --webservice-interface=any --webservice-port=8200 --portable-mode
swadams 432517 0.0 0.0 9220 2560 pts/0 S+ 17:43 0:00 grep --color=auto duplicati

Also, the “Test connection” button succeeds. What should I do to troubleshoot this?

Welcome to the forum @swadams2 but please note that this forum is mainly expert in Duplicati.

What happens? Any error? Did you run the mount command to see if the drive is now read-only?

You could try asking on an Ubuntu forum, but there are already various ideas available by search.

From a Duplicati point of view, if the permission (not the mount) is the only problem, you could run Duplicati as root, however you might be better off trying to figure out why the drive does as it does.

I didn’t see an error message when I tried to change permissions on it. I was able to get Duplicati to make the backups on the same disk it was on and manually copy them over to the external hard drive, so it’s writable.

As root, to bypass root folder permission issue? Why not create a subfolder for Duplicati use?

Yes, I did that with a “sudo” command. I just tried changing the ownership of the directory on the external hard drive, again with sudo, and got “Operation not permitted.”

Meaning mkdir, not chown of the root folder, but you might need chown or chmod of subfolder.

EDIT:

Although I’m not sure which directory “the directory” refers to. Original post was working with /

“The directory” refers to the subdirectory I made for the backups.

OK, so it’s not just the root, but a general Linux failure somehow after you made the folder.
If the problem is that the folder is 755 root, you might be able to get 777 root with umask 0.

# umask
0022
# mkdir sub1
# ls -ld sub1
drwxr-xr-x 2 root root 4096 Aug 28 13:15 sub1
# rmdir sub1
# umask 0
# mkdir sub1
# ls -ld sub1
drwxrwxrwx 2 root root 4096 Aug 28 13:15 sub1
# umask 22
# umask
0022
# 

Does the same operation work on other drives? If not, are any special security practices in use?

If it’s only on the external, how does that external drive show up on the mount command output?

Do you have any other drives to use? Do you know how drives are formatted? This sounds odd, however if you can characterize it well, the wisdom of the Web might know the issue. Go search.

From a Duplicati point of view, it needs OS level write permission provided to it like any program.

I normally access this server remotely via ThinLinc and I’m not the one who formatted the external hard drive and plugged it in, nor do I know if there are others, but here’s how it looks in the mount command output:
/dev/sda2 on /mnt type exfat (rw,relatime,fmask=0022,dmask=0022,iocharset=utf8,errors=remount-ro)

That’s probably enough to let you research it. exFAT doesn’t have the concept of a file owner.

can’t use chown with exfat! (recent and specific)

Ownership/permission problem with automounting exfat drive (older but has a single answer)

General idea seems to be that you can fix it with mount options. There is a lot of info available, however these are Linux questions, not Duplicati questions. If you want to make Duplicati root:

Installing Duplicati on Linux

talks about how it can be run by systemd. If you also want TrayIcon, use --no-hosted-server otherwise TrayIcon will talk to itself to run as your user, thus not be able to write root-only drive.

Okay, thanks for the information.

I did what that forum post said to do and now it works.

1 Like