You are not logged in.

#1 2021-07-30 08:19:11

thehexagon
Member
From: New Zealand
Registered: 2020-10-26
Posts: 76
Website

[SOLVED] Why is permission denied to make a folder in a usb

It's just what the subject is. I mounted the usb with

sudo mount /dev/sda1 /home/username/mountdir

Is this normal? As when I used a SD card, I could do whatever, make files, delete stuff, etc, without sudo, and yet I can't do anything with the usb. The usb doesn't have a read/write switch.

Last edited by thehexagon (2021-08-01 19:46:13)


NZ - UTC+12, or UTC+13 (depends on DST) | HP ENVY x360 2-in-1 Laptop 15-EW0009TX

Offline

#2 2021-07-30 08:27:21

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,310

Re: [SOLVED] Why is permission denied to make a folder in a usb

Which filesystem? Who's the owner?

stat /home/parmjot/mountdir

and check/post the output of mount.

Offline

#3 2021-07-30 08:31:14

thehexagon
Member
From: New Zealand
Registered: 2020-10-26
Posts: 76
Website

Re: [SOLVED] Why is permission denied to make a folder in a usb

usb is fat32, my device has ext4. Only one user so I'm the owner.

 parmjot@archcrypt  ~  stat /home/parmjot/mountdir  
  File: /home/parmjot/mountdir
  Size: 49152     	Blocks: 96         IO Block: 16384  directory
Device: 801h/2049d	Inode: 1           Links: 57
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 1970-01-01 12:00:00.000000000 +1200
Modify: 1970-01-01 12:00:00.000000000 +1200
Change: 1970-01-01 12:00:00.000000000 +1200
 Birth: -

NZ - UTC+12, or UTC+13 (depends on DST) | HP ENVY x360 2-in-1 Laptop 15-EW0009TX

Offline

#4 2021-07-30 08:36:15

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,310

Re: [SOLVED] Why is permission denied to make a folder in a usb

Well no, you're mounting it as root: https://wiki.archlinux.org/title/USB_st … ular_users

Your SD card either uses a file system that actually stores permissions or you have an fstab entry adjusting relevant logic here.

Last edited by V1del (2021-07-30 08:43:32)

Offline

#5 2021-07-30 22:42:46

thehexagon
Member
From: New Zealand
Registered: 2020-10-26
Posts: 76
Website

Re: [SOLVED] Why is permission denied to make a folder in a usb

even with the command in the wiki, adjusted for my case, it still needs perms to do stuff do it, like mkdir, etc. fstab has nothing about the usb drive, because it's the first time im using it with this machine. is it possible that I could do it so that I own the dir, with chmod or something?


NZ - UTC+12, or UTC+13 (depends on DST) | HP ENVY x360 2-in-1 Laptop 15-EW0009TX

Offline

#6 2021-07-30 22:48:38

Zod
Member
From: Hoosiertucky
Registered: 2019-03-10
Posts: 636

Re: [SOLVED] Why is permission denied to make a folder in a usb

chown

Offline

#7 2021-07-30 22:56:47

loqs
Member
Registered: 2014-03-06
Posts: 19,008

Re: [SOLVED] Why is permission denied to make a folder in a usb

Zod wrote:

chown

Not supported by fat32.

Last edited by loqs (2021-07-30 22:56:58)

Offline

#8 2021-07-30 23:04:59

Zod
Member
From: Hoosiertucky
Registered: 2019-03-10
Posts: 636

Re: [SOLVED] Why is permission denied to make a folder in a usb

loqs wrote:

Not supported by fat32.

Point taken.

I was going by this "my device has ext4".

Offline

#9 2021-07-31 06:38:14

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,372

Re: [SOLVED] Why is permission denied to make a folder in a usb

thehexagon wrote:

even with the command in the wiki, adjusted for my case

Please post what you actually adjusted as well as the output of "mount" …

it still needs perms to do stuff do it, like mkdir, etc. fstab has nothing about the usb drive, because it's the first time im using it with this machine. is it possible that I could do it so that I own the dir, with chmod or something?

… because this means you adjusted wrongly.
FAT is no real filesystem, there's nothing such as ownership or permissions on files.
They're all attributed to the whole branch when mounting the device.
You can tell the mount process what UID and GID to use and what permissions each file and directory shall have and/or to use the UID of the mounting user.
The only thing that could get in your way if the device is mounted read-only, but then even root couldn't write to it.

Offline

#10 2021-07-31 18:25:46

dakota
Member
Registered: 2016-05-20
Posts: 417

Re: [SOLVED] Why is permission denied to make a folder in a usb

thehexagon wrote:

even with the command in the wiki, adjusted for my case...

What was the command you used?


"Before Enlightenment chop wood, carry water. After Enlightenment chop wood, carry water." -- Zen proverb

Offline

#11 2021-08-01 19:13:39

thehexagon
Member
From: New Zealand
Registered: 2020-10-26
Posts: 76
Website

Re: [SOLVED] Why is permission denied to make a folder in a usb

my command

 parmjot@archcrypt  ~  sudo mount -o gid=users,fmask=113,dmask=002 /dev/sda1 /home/parmjot/dir
 parmjot@archcrypt  ~  

All i did was change the mountpoint


NZ - UTC+12, or UTC+13 (depends on DST) | HP ENVY x360 2-in-1 Laptop 15-EW0009TX

Offline

#12 2021-08-01 19:15:34

thehexagon
Member
From: New Zealand
Registered: 2020-10-26
Posts: 76
Website

Re: [SOLVED] Why is permission denied to make a folder in a usb

I found the issue with the above command, i'm not in the users group.


NZ - UTC+12, or UTC+13 (depends on DST) | HP ENVY x360 2-in-1 Laptop 15-EW0009TX

Offline

#13 2021-08-01 19:17:05

thehexagon
Member
From: New Zealand
Registered: 2020-10-26
Posts: 76
Website

Re: [SOLVED] Why is permission denied to make a folder in a usb

i did

 parmjot@archcrypt  ~  sudo mount -o gid=parmjot,fmask=113,dmask=002 /dev/sda1 dir
 parmjot@archcrypt  ~  cd dir         
 parmjot@archcrypt  ~/dir  mkdir d
 parmjot@archcrypt  ~/dir  

And It worked.


NZ - UTC+12, or UTC+13 (depends on DST) | HP ENVY x360 2-in-1 Laptop 15-EW0009TX

Offline

#14 2021-08-01 19:19:58

thehexagon
Member
From: New Zealand
Registered: 2020-10-26
Posts: 76
Website

Re: [SOLVED] Why is permission denied to make a folder in a usb

now I can't git clone to it:

 parmjot@archcrypt  ~/dir  git clone https://aur.archlinux.org/speed-dreams-svn.git
Cloning into 'speed-dreams-svn'...
error: chmod on /home/parmjot/dir/speed-dreams-svn/.git/config.lock failed: Operation not permitted
fatal: could not set 'core.filemode' to 'false'

NZ - UTC+12, or UTC+13 (depends on DST) | HP ENVY x360 2-in-1 Laptop 15-EW0009TX

Offline

#15 2021-08-01 19:25:40

SimonJ
Member
From: Spain
Registered: 2021-05-11
Posts: 361
Website

Re: [SOLVED] Why is permission denied to make a folder in a usb

loqs wrote:
Zod wrote:

chown

Not supported by fat32.

See above, permissions do not work on FAT32

Last edited by SimonJ (2021-08-01 19:26:11)


Rlu: 222126

Offline

#16 2021-08-01 19:29:58

thehexagon
Member
From: New Zealand
Registered: 2020-10-26
Posts: 76
Website

Re: [SOLVED] Why is permission denied to make a folder in a usb

So do I just reformat it? ext4 I'm geussing.


NZ - UTC+12, or UTC+13 (depends on DST) | HP ENVY x360 2-in-1 Laptop 15-EW0009TX

Offline

#17 2021-08-01 19:37:28

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,310

Re: [SOLVED] Why is permission denied to make a folder in a usb

Depends on what you intend to use it for. If you just use this as an expanded space but don't need to share it with a Windows install then ext4 would generally be the better option here, yes.

Offline

#18 2021-08-01 19:43:57

thehexagon
Member
From: New Zealand
Registered: 2020-10-26
Posts: 76
Website

Re: [SOLVED] Why is permission denied to make a folder in a usb

reformatted. I chowned the dir the usb was mounted in after I mounted it. btw, you cant mount with the uid, gid and all those options. those are for non unix filesystems


NZ - UTC+12, or UTC+13 (depends on DST) | HP ENVY x360 2-in-1 Laptop 15-EW0009TX

Offline

Board footer

Powered by FluxBB