0

I ran

sudo chmod -R 0777 /home/thomas/media/

But when I make new sub directories with transmission they do not have 777 permission.

Any tips?

Zanna
  • 70,465
thomas
  • 13
  • 2
  • 5
  • Well my first suggestion is to use a shared location outside home. My second suggestion is to use acl and read up on mask. To give a more specific answer we need more details. – Panther Sep 13 '17 at 17:15
  • 2
  • Tons of questions here on shared directories and acl - https://askubuntu.com/questions/202800/how-to-create-a-common-ext4-read-write-partition-with-all-ubuntu-users and https://askubuntu.com/questions/284845/copying-files-and-inherit-permissions-of-target-folder/284849#284849 and on .... – Panther Sep 13 '17 at 17:17
  • the answer to the suggested duplicate seems to be specific to Netatalk... It's not clear to me how it would be applied generally since it involves editing a config file belonging to Netatalk – Zanna Sep 13 '17 at 18:03

1 Answers1

4

Tip #1

Please don't give 777 permissions. There is (I think) always a better solution. It's very unsafe to give all permissions (especially write permission) to all users. If you need to grant permissions to specific user(s) or program(s), there are safe ways to do that

Tip #2

To set permissions on files that will be created in the future, you can't use chmod (although there is a permission bit called set-group-id (chmod g+s) which causes group ownership to be usefully inherited by subdirectories). You use umask for that.

Tip #3

However, fortunately, there is no umask setting so permissive as to grant 777 permission; in fact no umask setting will create executable files, for security reasons...

Tip #4

... which hints that the -R flag to chmod is not very useful, since we usually want directories to have execute permission, but we rarely want files to have execute permission. I advise you not to use recursive chmod unless you know exactly what is in the directory and are sure (ie you are making a well-informed choice) that you want to give those permissions to all of it.

Zanna
  • 70,465
  • ACL are the way to go. See https://askubuntu.com/questions/52584/how-do-i-set-up-a-folder-so-that-anything-created-in-it-inherits-permissions and https://help.ubuntu.com/community/FilePermissionsACLs and http://brunogirin.blogspot.com/2010/03/shared-folders-in-ubuntu-with-setgid.html – Panther Sep 13 '17 at 17:29
  • IMO this is not really an answer to the question, more an opinion, listing of problems and limitations, but I will not down vote. – Panther Sep 13 '17 at 17:31
  • iam the only user on the local server, used for hobby "work" and education. – thomas Sep 13 '17 at 17:33
  • @bodhi.zazen why not downvote if you think it's not an answer? Or you should flag it in that case, no? I am happy to listen to you. I think I read the question as written and answered it, but you are looking for the user's real problem - that's probably the right thing to do, but the question needs to be edited a lot in that case, I think, because as written it says (to paraphrase reasonably I hope) "I tried to chmod -R a directory and files created later didn't have the permissions I set, any tips?" Doesn't it? – Zanna Sep 13 '17 at 17:52
  • Typically I only down vote answers that I perceive as dangerous or potentially damaging to the system or flat our wrong. I was just adding my 2c and giving some advice. – Panther Sep 13 '17 at 17:54
  • @bodhi.zazen maybe I should delete my answer since you voted to close as duplicate? You mention advice and point to good resources, but I don't feel right changing my answer because it's not clear to me what OP really wants to do, only that they are currently doing it wrong. So, I would suggest you write a better answer, but if you want to close as duplicate instead maybe my answer is not useful and should be deleted. But if you understand the real problem, in my opinion it would be good to edit the question (then it will be obvious that my answer is not valid) – Zanna Sep 13 '17 at 17:59
  • I would leave it and I agree one reason I voted to close is the lack of details from the OP. – Panther Sep 13 '17 at 18:10