Set directory permission for a mounted SD disk

doopath

New Member
Joined
Jan 7, 2022
Messages
4
Reaction score
1
Credits
39
Hello there!
I cannot say I'am a newbie in Linux (i have been using it for a two years), but recently i bought a SD card for my laptop on Fedora Linux.
And everything just works fine: i edited the /etc/fstab file to mount my sd drive at /doodisk directory automatically.
But i cannot change file-access permissions (and owner) of the /doodisk direcotry (where my sd card - /dev/mmcblk0p1 is mounted).
I tried this commands:

Bash:
sudo su

chown doopath:doopath /doodisk
# or chown doopath:doopath -R /doodisk

chmod 755 /doodisk
# or chmod 755 -R /doodisk

and it doesn't work. Permission of the /doodisk directory are still:
4 drwxrwxrwx. 1 root root 4096 Jan 6 18:29 doodisk

I guess i can specify mount options in the /etc/fstab, but i didn't found how.
Actually my sd card is mounted by this option in /etc/fstab:
UUID=15AC524D34E4F77D /doodisk ntfs defaults 0 0

I need help to set this permission: 755 (drwxr-xr-x.) and this owner: doopath:doopath (gid=1000, uid=1000).
 


By default linux has "full" permssion on directories. This can be over-ridden.

To make a mount read only in fstab...

/dev/disk/by-uuid/68271755-703c-48e6-a935-c1237de6b1a8 /mnt/HDD01 auto ro,nosuid,nodev,nofail,x-gvfs-show 0

use the "ro" (read-only) flag. But it's all or none, not by user.
 
By default linux has "full" permssion on directories. This can be over-ridden.

To make a mount read only in fstab...

/dev/disk/by-uuid/68271755-703c-48e6-a935-c1237de6b1a8 /mnt/HDD01 auto ro,nosuid,nodev,nofail,x-gvfs-show 0

use the "ro" (read-only) flag. But it's all or none, not by user.
Thanx for the answer!
But i don't wanna make that read-only. I wanna set all permissions for the owner (which is actually root, but should be my user), and read&execute for all others.
 
chown -R user:user /doodisk

You will have to do this as root, if root already owns it.
All users are in their own group. So user:user means myself and my group.
 
chown -R user:user /doodisk

You will have to do this as root, if root already owns it.
All users are in their own group. So user:user means myself and my group.
I've tried to do that, but unfortunately that doesn't work. I even tried to unmount the disk and change permissions of the /dev/mmcblk0p1 and /doodisk dirs. Have no idea how to set all of the stuff ;(
 

Attachments

  • Screenshot-20220107155625-793x541.png
    Screenshot-20220107155625-793x541.png
    83.3 KB · Views: 312
Oh, so I've completely figured out. The problem is ntfs file system on my sd disk, because of that keeps all of the permissions and other FS data inside itself. So I just couldn't change permissions of a mounted disk by chmod and owner by chown.
Solution:
Unmount the disk and format it as ext4/btrfs/f2fs (maybe FAT also works - i dunno). Btrfs works fine in my case, and it allows you to change permission of a folder when your disk is mounted.
 

Members online


Top