Tacocat
Posts: 4
Joined: Sun Feb 02, 2020 9:59 pm

USB Permission Error

Mon Feb 03, 2020 2:49 am

Hello.
When I insert a USB into my Raspberry Pi, and try to open a txt file within the USB, I get a permission error. The error says permission denied to open the file. When I try to alter the permissions of the file, I get the same error: I do not have permission to change the permissions.
Is there any way to fix this?
Thanks :)
Fun facts:
  • Taco cat is a palindrome (meaning it is the same spelled backwards and forwards).
  • Racecar is also a palindrome.
  • The number 10801 is a palindrome.
  • "Never odd or even" is a palindromic phrase.

ejolson
Posts: 4877
Joined: Tue Mar 18, 2014 11:47 am

Re: USB Permission Error

Mon Feb 03, 2020 3:43 am

Tacocat wrote:
Mon Feb 03, 2020 2:49 am
Hello.
When I insert a USB into my Raspberry Pi, and try to open a txt file within the USB, I get a permission error. The error says permission denied to open the file. When I try to alter the permissions of the file, I get the same error: I do not have permission to change the permissions.
Is there any way to fix this?
Thanks :)
You could try setting the permissions using sudo. Are you logged in with the pi username or as tacocat?

User avatar
DougieLawson
Posts: 38479
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: USB Permission Error

Mon Feb 03, 2020 11:53 am

Mount the USB drive with -o uid=pi,gid=pi and your non-privileged user pi will have full access.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

I'll do your homework for you for a suitable fee.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

GlowInTheDark
Posts: 445
Joined: Sat Nov 09, 2019 12:14 pm

Re: USB Permission Error

Mon Feb 03, 2020 12:01 pm

1) This thread is a duplicate.

2) This is not supposed to happen if you do things the "normal" way and the drive is formatted FAT or FAT32, etc. What I mean by that is that if you insert the drive and it gets automounted, then it will end up owned by "you" and things should "just work". I.e., you don't need the "-o user" stuff.

3) If it is not formatted FAT-something - i.e., if it is a Unix-type filesystem (e.g., ext2, 3, 4), then it will have its own permissions and in that case, there isn't really anything you can do about it that does not involve using root in some way. The OP seems to imply that he is either not able or is forbidden to do that.
GitD's list of things that are not ready for prime time:
1) IPv6
2) 64 bit OSes
3) USB 3
4) Bluetooth

User avatar
thagrol
Posts: 2682
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: USB Permission Error

Mon Feb 03, 2020 2:09 pm

GlowInTheDark wrote:
Mon Feb 03, 2020 12:01 pm
1) This thread is a duplicate.
Link please (and report it). The question has been asked before but that doesn't make this a duplicate.
2) This is not supposed to happen if you do things the "normal" way and the drive is formatted FAT or FAT32, etc. What I mean by that is that if you insert the drive and it gets automounted, then it will end up owned by "you" and things should "just work". I.e., you don't need the "-o user" stuff.
You're showing a lack of experience and making some assumptions.

The type of automounting you describe will only work if the desktop is installed and a user is logged in. You're also assuming that the user attempting access is the same one that is logged in to the desktop. Neither may be the case.

We also have no idea how @Tacocat (the OP) is mounting the device in question.

Automounting in the desktop is not restricted to FAT as you appear to imply. Pretty much any filesystem supported may be mounted this way.
3) If it is not formatted FAT-something - i.e., if it is a Unix-type filesystem (e.g., ext2, 3, 4), then it will have its own permissions and in that case, there isn't really anything you can do about it that does not involve using root in some way. The OP seems to imply that he is either not able or is forbidden to do that.
Not all non-FAT file systems are linux/unix file systems and support linux file permissions. For those that don't usually the only way to tweak permissions is in the mount options.

@DougieLawson and @ejolson suggestions are possible solutions but without mroe information from @Tacocat no-one can suggest a more accurate fix.

I also see nothing in the OP to justify what you claim they're implying.
Attempts to contact me outside of these forums will be ignored unless signed in triplicate, sent in, sent back, queried, lost, found, subjected to public enquiry, lost again, and finally buried in soft peat for three months and recycled as firelighters

User avatar
jojopi
Posts: 3190
Joined: Tue Oct 11, 2011 8:38 pm

Re: USB Permission Error

Mon Feb 03, 2020 4:37 pm

thagrol wrote:
Mon Feb 03, 2020 2:09 pm
Link please (and report it). The question has been asked before but that doesn't make this a duplicate.
OP shows two posts, but only one is available. So a duplicate has been deleted by now. This is not uncommon, because each user's first post to this forum is delayed by moderator checks against spam, etc.

I agree that we can not help much more unless OP returns to confirm details.

ejolson
Posts: 4877
Joined: Tue Mar 18, 2014 11:47 am

Re: USB Permission Error

Mon Feb 03, 2020 5:05 pm

jojopi wrote:
Mon Feb 03, 2020 4:37 pm
thagrol wrote:
Mon Feb 03, 2020 2:09 pm
Link please (and report it). The question has been asked before but that doesn't make this a duplicate.
OP shows two posts, but only one is available. So a duplicate has been deleted by now. This is not uncommon, because each user's first post to this forum is delayed by moderator checks against spam, etc.

I agree that we can not help much more unless OP returns to confirm details.
The delay of the first post appearing is a good explanation why the first posts of so many new members are double. I'd never thought about that.

Anyway, to the person making the original post, welcome to the forum! I hope you get your problem resolved and post back the outcome in either case.

User avatar
thagrol
Posts: 2682
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: USB Permission Error

Mon Feb 03, 2020 5:27 pm

ejolson wrote:
Mon Feb 03, 2020 5:05 pm
jojopi wrote:
Mon Feb 03, 2020 4:37 pm
thagrol wrote:
Mon Feb 03, 2020 2:09 pm
Link please (and report it). The question has been asked before but that doesn't make this a duplicate.
OP shows two posts, but only one is available. So a duplicate has been deleted by now. This is not uncommon, because each user's first post to this forum is delayed by moderator checks against spam, etc.

I agree that we can not help much more unless OP returns to confirm details.
The delay of the first post appearing is a good explanation why the first posts of so many new members are double. I'd never thought about that.
Hmm, yes. I have to agree here.

However my admittedly badly made point was that posting "This thread is a duplicate. " in a thread doesn't help anyone nor does it help resolve the duplication (especially when you go on to answer the post in question). Posts need to be reported for that to happen. Secondarily, so many unsubstantiated claims get made on this forum that these days I tend to ask for supporting evidence.
Anyway, to the person making the original post, welcome to the forum! I hope you get your problem resolved and post back the outcome in either case.
Likewise.
Attempts to contact me outside of these forums will be ignored unless signed in triplicate, sent in, sent back, queried, lost, found, subjected to public enquiry, lost again, and finally buried in soft peat for three months and recycled as firelighters

Return to “Troubleshooting”