How to give permission to user after mounting a hard disk on Centos 7?

6,734

Best would be to add some mount options for the vfat filesystem like umask or uid/gid.

The uid mount option gives a specific user the access on the mountpoint.

mount -o uid=user,gid=group /dev/vdd /mnt

Adding umask=0 would give write access to anyone.

mount -o uid=user,gid=group,umask=0 /dev/vdd /mnt
Share:
6,734

Related videos on Youtube

Admin
Author by

Admin

Updated on December 01, 2022

Comments

  • Admin
    Admin over 1 year

    I have a HP Microserver gen 8 that i'm using as a NAS at my home, with Centos 7.

    And i just got a new hard disk 2 TB, after i installed it in the bay, and rebooted the system.

    I've used fdisk to make the partition, and after that i used: mkfs -t vfat /dev/sda1 to create fat32.

    after i mounted : mount /dev/sda1 /nas

    i can access it with root user and create folders .. etc, but when i access it (from SSH not samba) with my user (which is samba user also) i can only read, i can't create folders, files ... etc.

    result of fdisk -l:

    Disk /dev/sda: 2000.4 GB, 2000398934016 bytes, 3907029168 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 4096 bytes
    I/O size (minimum/optimal): 4096 bytes / 4096 bytes
    Disk label type: dos
    Disk identifier: 0x3833350a
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sda1            2048  3907029167  1953513560   83  Linux
    

    result of ls -ld /nas:

    drwxr-xr-x. 2 root root 32K Nov  5 16:42 /nas
    

    What can i do, so my user can have permissions on this mounted /nas ?

  • Admin
    Admin over 7 years
    Thanks for the answer, i made a folder media with root and when chown abude media, it gives me chown: changing ownership of 'media/': Operation not permitted, any ideas ?