Permission denied - USB drive
Solved
Hello,
I currently have a Raspberry Pi 3 B.
I have plugged in a USB stick, and I am unable to copy a file or folder onto it.
(It works in root, BUT):
I have an open proftpd server, and I want to put files on this USB stick, but I don't have the permissions.
-I would like to know how to grant all rights on this stick to all users of the machine.
Thank you in advance :)
I currently have a Raspberry Pi 3 B.
I have plugged in a USB stick, and I am unable to copy a file or folder onto it.
(It works in root, BUT):
I have an open proftpd server, and I want to put files on this USB stick, but I don't have the permissions.
-I would like to know how to grant all rights on this stick to all users of the machine.
Thank you in advance :)
1 answer
Hello,
Generally speaking, it is not a good idea to grant access rights to everyone on a key. Typically, only the user who mounted the key has write permissions on it, and that is the correct approach. When access needs to be granted to multiple users, it is better to define a group that includes the people who have access to the key in question.
In any case, all of these questions are resolved at the time of mounting the key (see command
In your case, the key will be identified by a device (for example
Next, you need to create an empty directory (mount point) where the key will appear. Let's say
Then you mount the key, with the right options (once again, I insist: this is NOT a command I recommend, but it does what you're asking):
For more details, see
To understand what follows, read
The mask values correspond to the complement (in the mathematical sense) of the mask passed to the
Good luck!
Generally speaking, it is not a good idea to grant access rights to everyone on a key. Typically, only the user who mounted the key has write permissions on it, and that is the correct approach. When access needs to be granted to multiple users, it is better to define a group that includes the people who have access to the key in question.
In any case, all of these questions are resolved at the time of mounting the key (see command
mount), which allows you to specify the owner user of the key, the owner group, and the associated rights to the files on the key.
In your case, the key will be identified by a device (for example
/dev/sdb1, assuming that
/dev/sdacorresponds to your hard drive). You can find this information using the command
sudo fdisk -l.
Next, you need to create an empty directory (mount point) where the key will appear. Let's say
/media/usb.
sudo mkdir -p /media/usb
Then you mount the key, with the right options (once again, I insist: this is NOT a command I recommend, but it does what you're asking):
sudo mount -o default,rw,user,dmask=000,fmask=111 /dev/sdb1 /media/usb
For more details, see
man mountand this link to understand mask issues. Basically,
dmaskand
fmaskcorrespond to the rights associated with directories and regular files.
To understand what follows, read
man chmodbeforehand to understand how the octal syntax used by this command is defined.
The mask values correspond to the complement (in the mathematical sense) of the mask passed to the
chmodcommand (so for example, applying
chmod 755on directories means setting a
dmaskequal to
022). To put it simply,
mask_chmod + dmask = 777. The principle is the same for
fmask.
Good luck!
For the command . I looked at (and tried to understand at the same time) the permissions, and I saw that default could be an issue, so I removed it, and it worked :D
I restarted the Raspberry, and :) it didn't work anymore :-| I went back to the /etc/fstab file to remove the default that I hadn't seen.
Now it's perfect.
Thank you <3