Score:0

Permanent access to a usergroup for a usb drive

us flag

I have a USB flash drive which gets mounted to /media/pi/76E8-CACF (pi is my main user).

pi@raspberrypi:~ $ ls -ld /media/pi/76E8-CACF
drwxr-xr-x 3 pi pi 131072 Jul 23 23:54 /media/pi/76E8-CACF

I have created 2 new UNIX users and added them in a usergroup (including pi).

pi@raspberrypi:~ $ grep sambagroup /etc/group
sambagroup:x:1003:Space_Legion,pi,Space_Android

I want to permanently give rw permissions to this new usergroup.

The end goal is these users to be able to access the contents of the USB using samba.

I am running Raspbian OS, as you probably guessed.

waltinator avatar
it flag
Raspbian OS is not a supported Ubuntu release, and is not supported on AskUbuntu.
Score:0
es flag

One way is to edit /etc/samba/smb.conf and at the end of the file add a share definition to the default USB mount point parent. Something like this:

[USB]
path = /media/pi
read only = No
valid users = @sambagroup
force user = pi

Then restart smbd:

sudo service smbd restart

*** The only users that will gain access are members of the sambagroup group ( @sambagroup )

*** Once authenticated their identities - for this share anyway - will be changed to pi ( force user = pi ) who is the only user that can traverse the /media/pi folder.

This will allow access to anything mounted under /media/pi. You can make it specific to one particular USB device by changing the path to that device:

path = /media/pi/76E8-CACF
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.