0

First of all let me say that i am almost new to Linux so please be patient :) I have an Ubuntu 14.0.4 running on my Systems.

What i am trying to do is: On my system there are sabnzbd and plex running. sabnzbd is running as root and plex has an own user (plex) with an own group (plex).

What i need is that the user plex, myuser and also sabnzbd (root) have read, write and execute permission at /media and also all subfolders and files. I studied now a lot of stuff at the internet and tried my luck with chmod; chown; the /etc/group file; and many more but i am to stupid to get it to work.

Can someone tell me what i need?

1

For a little more secure approach I'd recommend creating a group for those 3 users and then chown'ing the directory by the group.

1. sudo groupadd mygroup

2. sudo usermod -aG {group-name} username

In your case it'd be

sudo usermod -aG mygroup plex ; sudo usermod -aG mygroup root ; sudo usermod -aG mygroup myuser

3. chown -Rf :mygroup /media
  • Sound pretty good - thanks. Just one more thing. Under /media there i have an ntfs hdd mounted with the permission option at fstab. Can i somehow remove unneccessary permissions first because acl is active and i already messed up a bit :( or will chown remove everything anyway? I tested now and "sudo useradd -G mygroup plex" will give me back something like this "useradd: User >>plex<< already exists" also for the other users. – Panic0815 Nov 10 '14 at 21:15
  • Sorry i got the wrong command. Edited the answer accordingly. In case of the ntfs i think that the chown will edit the permissions anyway, but in case any problem arise don't hesitate to comment here – Genesis Nov 10 '14 at 21:33
  • I did this now and rebooted my system. Access seems to be OK but i seem no to be a sudoer any more: myuser ist nicht in der sudoers-Datei. Dieser Vorfall wird gemeldet. - myuser is not an member of the sudoers file. What to do? – Panic0815 Nov 12 '14 at 6:31
  • Reboot to the recovery console and add your user back to sudo from there on newer installations you will likely need to remount the root filesystem read-write first # mount -o remount,rw / # usermod -aG sudo user # exit – Genesis Nov 12 '14 at 7:49
  • Sorry for late reply. I was not able to boot into recovery - my system is to fast :) But i did reinstall the system because a lot of stuff were messed up anyway. It now worked with the -aG comment thx. One more thing left - sabnzbd is running as root and moving files to /media/Store where i changed the permission as shown above. The new files to not take over the permission and belong to root:root and that a problem because i now cant change them (PS: The folder /media/Store is also shared with smaba) so it would be good that all permissions are myuser:mygroup and this also for new files. – Panic0815 Nov 14 '14 at 12:52
0

You just need to perform this following command:

sudo chmod -Rf 777 /media

where:

-Rf will force change the permissions recursively.

"777" will get for root, root group and others the permission for read, write and execute everything on the directory.

  • This grants write privileges to everybody, not just the 3 mentioned users, and may not be what OP wants or needs. It also makes all files executable, which may lead to confusion and even security problems. – David Foerster Nov 12 '14 at 16:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.