Change permissions per user?

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
Post Reply
FalconX
Posts: 33
Joined: Fri Aug 30, 2019 3:33 pm

Change permissions per user?

Post by FalconX »

I don't know, how to change permissions for users.
The users root and emby are writing 0644 files, I can't delete them from my Windows system.
How do I change the permissions permanent for further files in the future to 777?
User avatar
johnvick
Legend
Posts: 693
Joined: Wed Jun 08, 2016 11:53 am
Location: New Zealand

Re: Change permissions per user?

Post by johnvick »

I don't think you can change future files to 777 and it wouldn't be wise anyway. The approach you need is to edit /etc/samba/smb.conf to your needs - this is an example from my config. This way you should be able to delete files from Windows.

[home]
comment = Home
path = /home/john
browseable = yes
read only = no
create mask = 0775
directory mask = 0775
valid users = root
guest ok = no
writeable = yes
public = no
FalconX
Posts: 33
Joined: Fri Aug 30, 2019 3:33 pm

Re: Change permissions per user?

Post by FalconX »

Thanks for your answer and the hint with leaving the permissions to 775 instead.

I have changed dietpi to root, and now I can login with root in Windows and delete stuff on my Samba share.

Doesn't the command "create mask" and "directory mask" with 0775 implied that the share is writeable and not read only?
For what do I need the extra commands "writeable = yes" & "read only = no", are these commands really neccessary?
I've deleted "read only = no" and don't see a difference - still can delete files with Windows.

Still need to figure out the permissions for the other users, emby... and don't know, which user is registered to my other software like Docker and their containers... :?
User avatar
johnvick
Legend
Posts: 693
Joined: Wed Jun 08, 2016 11:53 am
Location: New Zealand

Re: Change permissions per user?

Post by johnvick »

I'm not sure about the other samba parameters I just go with what DietPi sets and change only if something isn't working.

John
FalconX
Posts: 33
Joined: Fri Aug 30, 2019 3:33 pm

Re: Change permissions per user?

Post by FalconX »

Still have one right permission problem, not concerning my SambaShare, but with tvheadend, which runs inside Docker.

I have set PUID and PGID to 1000, which is the user DietPi. I've also put DietPi in the group video.
The folder dev/dvb is owned by root with 0660 rights and the files inside this folder belong to the video group.
(dev/dvb/adapter0 contains the informations to access my DVB-S card.)

Changing the folder to 0777 or the owner to DietPi doesn't work well, everytime I reboot DietPi, DietPi set it back to default values (root with 06660)... really annoying. Why does DietPi can't keep my permission rights?
I also don't get it why it doesn't work with DietPi in the "video" group < in Docker PGID 1000, 44 (or can I just set one group!?)
(44 = video)

With setting PUID and PGID to 0 (root) it works, TV adapter shows up in TVHeadend. But is this really the best solution?
Like already mentioned here, setting everything to 0777 or letting containers run with full root rights isn't the best idea.

Update:
Just in case, someone might have the same problem, I think I've found a better solution.
I've copied the dev/dvb folder from PI to my NAS inside my TVHeadend configuration folder and gave the folder 0777 rights (or change the owner accodingly).
In Docker > TVHeadend container I've set a Volume bind to my new folder path on my NAS.
So, no need TVHeadend has to run as root and DietPI don't need to be in the video group (which didn't work anyway).
User avatar
MichaIng
Site Admin
Posts: 2423
Joined: Sat Nov 18, 2017 6:21 pm

Re: Change permissions per user?

Post by MichaIng »

@FalconX
Note that all files/dirs inside /dev are temporary kernel API files that only live in RAM and are freshly created on every boot. There is no real suitable way to set permissions for them permanently and wouldn't be wise as well.
So what you need to do is indeed adding the users to the related groups to access them.

The problem with the tvheadend is that it explizitely runs as dietpi user and group only, but it does not open a real session with this user. So supplementary groups (like video, which dietpi is inside by default anyway) have no effect in this case. So what you need to do then is to run tvheadend as video group.

Another possibility, which could be tested, is to not set PGID at all. Probably the users default group with supplementary groups being effective as well, is used.

And finally not sure which user it runs by default, the "docker" user? So you could as well add "docker" to video group and in case to dietpi group (if you need some local media file access or such).
Post Reply