Can't download to custom location - permission issue

General support for problems installing or using Deluge
trueotacon
Member
Member
Posts: 15
Joined: Tue Jan 26, 2021 7:23 pm

Can't download to custom location - permission issue

Post by trueotacon »

Hi guys, I need help with my Duleged installation. For sure, something is wrong because I don't undertand all the steps to install it and had missed some important configuration. So what I have is a remote pc with ssh enabled, dedicated to be a download manager and I'm using deluge web to manage all my downloads. What is the problem? In my specific case I can't download files in a custom folder but maybe also all the "deluge user " configuration have something wrong because when I use deluge web to get a GUI i can see only "local" as user and not "deluge". BUT, first thing first, my problem with custom download location.

So I have TWO PARTITIONS: the root with all the configuration and the seccond one havo only the home folder. If I leave the default location of deluged, I can download files without problems because as default the download folder is /srv/deluge/Downloads. But this folder is small cause is inside the root partition. I want the download location to be in my home folder, in the bigger partition (/home/username/tors/). But what I get is an error "permission denied" in web/gui

Some informations:

systemctl status deluged

Code: Select all

● deluged.service - Deluge Bittorrent Client Daemon
     Loaded: loaded (/etc/systemd/system/deluged.service; enabled; vendor preset: disabled)
    Drop-In: /usr/lib/systemd/system/deluged.service.d
             └─user.conf
     Active: active (running) since Wed 2021-06-02 12:37:39 CEST; 5h 4min ago
       Docs: man:deluged
   Main PID: 547 (deluged)
      Tasks: 4 (limit: 19125)
     Memory: 60.1M
     CGroup: /system.slice/deluged.service
             └─547 /usr/bin/python /usr/bin/deluged -d

cat /etc/systemd/system/deluged.service

Code: Select all

[Unit]
Description=Deluge Bittorrent Client Daemon
Documentation=man:deluged
After=network-online.target

[Service]
Type=simple
User=deluge
Group=deluge
#UMask=007
UMask-000

ExecStart=/usr/bin/deluged -d

Restart=on-failure

# Time to wait before forcefully stopped.
TimeoutStopSec=300

[Install]
WantedBy=multi-user.target
cat /usr/lib/systemd/system/deluged.service

Code: Select all

[Unit]
Description=Deluge Bittorrent Client Daemon
Documentation=man:deluged
After=network-online.target

[Service]
Type=simple
UMask=007

ExecStart=/usr/bin/deluged -d

Restart=on-failure

# Time to wait before forcefully stopped.
TimeoutStopSec=300

[Install]
WantedBy=multi-user.target
cat /usr/lib/systemd/system/deluged.service.d/user.conf

Code: Select all

[Service]
User=deluge
Group=deluge
ls -lF of my custom folder that I want to use (is not working)

Code: Select all

drwxrwxrwx 4 deluge deluge 274432 10 mag 17.57  tors/
and the ones from default download location (is working)

Code: Select all

drwxrwx--- 2 deluge deluge 4096  2 giu 11.51 Downloads/
/home/username/.config/deluge (I havn't created it, is there maybe self done, IDK)
auth file

Code: Select all

localclient:d9c5a81a5e277b245763436ad552296c7eba269c:10
/srv/deluge/.config/deluge
auth file

Code: Select all

localclient:e1faf84dbf27eec924a6d4de81da2c65029136c3:10
If you need something else just ask. Can you help resole this issue? I had tried to change the torrent server/client but deluge is deluge...
shamael
Compulsive Poster
Compulsive Poster
Posts: 667
Joined: Sat Oct 08, 2016 9:28 am

Re: Can't download to custom location - permission issue

Post by shamael »

Hi,

So you have 2 systemd unit launching Deluge or am I misreading/missing something?
/usr/lib/systemd/ comes normaly for packet installed by packet manager
/etc/systemd/ is where you put custom things, the location I choose on my own system (Debian based)

Have you followed the wiki about how to make the systemd unit?

With the command "PS" how many deluged process do you see, and running under which user?
trueotacon
Member
Member
Posts: 15
Joined: Tue Jan 26, 2021 7:23 pm

Re: Can't download to custom location - permission issue

Post by trueotacon »

Hm, you say that I have two systemd units, I don't know. Maybe this is the reason that I'm here, I hadn't thought about it.

Arch Wiki is not easy for me, maybe I had done some mistake during the installation process. I'd tried.

Here is the output of "ps -aux | grep deluge" and "grep deluged"

Code: Select all

> ps -aux | grep deluge
deluge       549  0.0  0.3  78448 63756 ?        Ss   giu02   0:20 deluge-web
deluge      7694  0.1  0.3 585832 60184 ?        Ssl  giu02   2:01 /usr/bin/python /usr/bin/deluged -d
otacon     14322  0.0  0.0   6772  2308 pts/0    S+   13:03   0:00 grep deluge

> ps -aux | grep deluged
deluge      7694  0.1  0.3 585832 60184 ?        Ssl  giu02   2:01 /usr/bin/python /usr/bin/deluged -d
otacon     14324  0.0  0.0   6772  2320 pts/0    S+   13:04   0:00 grep deluged

mhertz
Moderator
Moderator
Posts: 2195
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Can't download to custom location - permission issue

Post by mhertz »

Sorry for interupting and I know you're in good hands already, but just wanted to quickly add that you're probably missing execute permission in your user directory under /home, meaning the perms on download folder effectively gets unattainable as no traversal allowed into it then regardless. If your user is in deluge group, then i'd guess 'sudo chmod g+r /home/user' would do, or else 'sudo chmod a+r /home/user'.

Don't worry about webUI etc stating localclient as user, which is unrelated to actual deluge user, and just is a default designation used by deluge for making auto-authentication possible for localhost thinclient connections from same user.

Yes arch's deluge package adds the two vanilla deluged and deluge-web systemd service files direct from upstream's gitrepo and installed under /usr/lib/systemd/*, so no need mess with the steps for generating those in the deluge documentation, and so a simple 'sudo systemctl enable deluged deluge-web' is enough to get them copied to /etc/systemd/* and enabled at boot - I see you added user and group to the deluged one, but no need as the included user.conf override from upstream does that allready, but doesn't neither hurt however.
trueotacon
Member
Member
Posts: 15
Joined: Tue Jan 26, 2021 7:23 pm

Re: Can't download to custom location - permission issue

Post by trueotacon »

I had checked the permission for my home directory "7home/otacon/" and inside there is the custom folder destinated to deluge "tors"

ls -lF of /home

Code: Select all

drwxr-xr-x   4 root root         4096 23 gen 05.55 home/
ls -lF of /home/otacon (the user folder)

Code: Select all

drwx------- 23 otacon otacon 4096 3 giu 15.05 otacon/
ls -lF of /home/otacon/tors (the custom destination)

Code: Select all

drwxrwxrwx 4 deluge deluge 274432 10 mag 17.57  tors/
I had tried yesterday to add deluge user to my user group as you can see down in the output. Is Deluge user now able to write files inside my home folder?
groups otacon (my user)

Code: Select all

wheel deluge otacon
groups deluge (deluge user)

Code: Select all

otacon deluge
mhertz
Moderator
Moderator
Posts: 2195
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Can't download to custom location - permission issue

Post by mhertz »

No, as still need execute permission for group on folder '/home/otacon': 'sudo chmod g+x /home/otacon'.

Hmm, come to think of it, I think I misunderstood little bit this perm stuff, sorry, I'm not good at these things honestly, so I'd presume group permissions on that folder, only relates to otacon group members, which deluge aren't, and adding otacon to deluge user isn't good, so scratch the previous suggested line and instead you would need then 'sudo chmod o+x /home/otacon'. Shamael or others more knowledgeable than me will kindly correct me if wrong of-course :)
trueotacon
Member
Member
Posts: 15
Joined: Tue Jan 26, 2021 7:23 pm

Re: Can't download to custom location - permission issue

Post by trueotacon »

I had tried "sudo chmod o+x /home/otacon" but nothing had changed, I still can't download files in my custom directory "tors"
mhertz
Moderator
Moderator
Posts: 2195
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Can't download to custom location - permission issue

Post by mhertz »

Hmm, I just tried with exact, to the letter, permissions as you, while on arch and using same deluge package as you(deluge from extra repo) - initially fails when changing download dir away from default, and succeds after running 'sudo chmod o+x ****'.

Sorry, I don't know why doesn't work for you honestly.

Edit: Okay, i'm biggest moron of all time seemingly lol, I apologize, it should indeed be sudo chmod g+x on tors dir - I was looking at group ownership of your home-dir for some reason initially, doh. Sorry again. Note presumes you still have deluge under your user's group, as you posted before, as if not having that anymore, and not wanna readd, then would need the chmod g+x instead. Hope i'm not mistaken again here, as said, not really my forte, or how to say :) Just recently by chance learned unrelated that the execute bit on directories wasen't redundant, but actually had important functionality i.e. traversal ability.
trueotacon
Member
Member
Posts: 15
Joined: Tue Jan 26, 2021 7:23 pm

Re: Can't download to custom location - permission issue

Post by trueotacon »

I had tried "chmod g+x" to tors directory, and also "/tors/temp" (temporary directory) and /tors/tors (tor files directory)
Restarted deluged and nothing, same error on WebGUI, permisson denied.
mhertz
Moderator
Moderator
Posts: 2195
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Can't download to custom location - permission issue

Post by mhertz »

Sorry I don't know how the f I can continue to screw things up like that, damn, I apologize, I should have posted to you that you should run that chmod command on the user-dir of yours, not tors, as already has adequate perms, sorry again.

So, 'sudo chmod o+x /home/otacon'(could also use 'a+x' for all cases regardless).

If still not working, then just in case I would try add a new dir and sub-dir under root, so e.g. 'sudo mkdir -p /foo/bar', and then 'sudo chown deluge: /foo/bar' and 'sudo chmod a+x /foo' and select /foo/bar as deluge download dir and see if works - just to check that atleast something works, e.g. that was what I did, as didn't like messing with my own user-dirs permissions, but reproduced your perms for the test on those. I once had issue where it didn't work no matter what, where later found that because I had /etc/resolv.conf mistakenly only allowing my main user read-access, though shouldn't be normal case whatsoever, but just to test that there's not other things involved than pure permissions. Also, please repost perms of /home, /home/otacon and /home/otacon/tors if still not work, thanks, plus specify if you have setup deluge to move completed or save torrents, besides the regular download dir, in which case you'd need 'sudo chown -R deluge: /home/otacon/tors' to fix that.

Edit: Fixed more faults, this just really isn't my day today it seems, and apparently keeping tabs of two separate dirs is a major undertaken for me and borderline pushing it lmfao, embarrassingly stupid honestly, but that's what I get by butting in on good people here :)

Edit2: Just rechecked your older posts, and I'd recommend removing otacon group from deluge user, as for security that is a restricted account without any group memberships, but if keeping it as is, then would instead need 'g+x' or 'a+x' instead of 'o+x' on /home/otacon in previous instructions given.
Post Reply