0

i have a player that auto download the files if i plug in usb, for some pc its working smoothly but i got problem for some pc with same OS ( ubuntu ) but different type and i test to give full permission access ( 777 ) to the files manually with chmod and its working

try to edit fstab but the usb uuid not shown :

UUID=C0C2-706F                            /boot/efi      vfat    umask=0077 0 2
UUID=d2187334-fc44-48c1-9226-f23f6289d985 /              ext4    defaults   0 1

result for the mount :

/dev/sda2 on /media/amg/TO1 type vfat (rw,nosuid,nodev,relatime,uid=1000,gid=1001,fmask=0022,dmask=0022,codepage=437,ioc            harset=iso8859-1,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)

result for lsb_release - a;uname -a :

amg@amg:~$ lsb_release -a;uname -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.3 LTS
Release:        20.04
Codename:       focal
Linux amg 5.11.0-27-generic #29~20.04.1-Ubuntu SMP Wed Aug 11 15:58:17 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

result for lsblk ( usb at sda2 ):

amg@amg:~$ lsblk
NAME         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda            8:0    1  7,3G  0 disk
├─sda1         8:1    1  200M  0 part
└─sda2         8:2    1  7,1G  0 part /media/amg/TO1
mmcblk0      179:0    0 29,1G  0 disk
├─mmcblk0p1  179:1    0  300M  0 part /boot/efi
└─mmcblk0p2  179:2    0 28,8G  0 part /
mmcblk0boot0 179:8    0    4M  1 disk
mmcblk0boot1 179:16   0    4M  1 disk

result for lsblk -e7 -o model,name,size,fstype,uuid :

amg@amg:~$ lsblk -e7 -o model,name,size,fstype,uuid
MODEL        NAME          SIZE FSTYPE UUID
Cruzer_Blade sda           7,3G
             ├─sda1        200M vfat   67E3-17ED
             └─sda2        7,1G vfat   D078-0D63
             mmcblk0      29,1G
             ├─mmcblk0p1   300M vfat   C0C2-706F
             └─mmcblk0p2  28,8G ext4   d2187334-fc44-48c1-9226-f23f6289d985
             mmcblk0boot0    4M
             mmcblk0boot1    4M

my question is how to make the subfolder file get auto full permission when i plug in the usb ?

thanks

sudodus
  • 47,684
adrian
  • 27
  • 5

1 Answers1

0

It should work to mount the partition in the USB drive after editing the following line into /etc/fstab (assuming access for the first user (with uid=1000). Open the file in a text editor

sudo nano /etc/fstab

add one of the following lines and finally save the edited file with ctrl + x (and y for yes).

  • alternative 1, drive always to be plugged in (and automatically mounted at boot),

    UUID=D078-0D63  /mnt/usbdata  vfat  rw,user,uid=1000,dmask=007,fmask=117  0  0
    
  • alternative 2, drive to be plugged in when computer is running,

    UUID=D078-0D63  /mnt/usbdata  vfat  noauto,rw,user,uid=1000,dmask=007,fmask=117  0  0
    

    Here you must also mount the file system by

    sudo mount /mnt/usbdata
    
  • creating a mountpoint

    sudo mkdir /mnt/usbdata
    
  • and rebooting.


  • If you format the drive, the UUID will change and you can use

    lsblk -e7 -o model,name,size,fstype,uuid
    

    to find the new UUID.

  • If you want to modify the permissions, see this link.

  • If still no luck mounting the file system in the USB drive, the best tip I can think of is that Windows has left the drive 'dirty', and you can try to repair it with Windows tools.

    This can be avoided if you turn off fast startup in Windows, and always use safe removal of the drive (flush the buffers so that the write operations reach the memory cells before you unplug the drive). In Ubuntu you can do that with the command

    sync
    

    or 'eject' in the graphical interface. A safe way to sync and prevent further writes is to unmount,

    sudo umount /mnt/usbdata
    
sudodus
  • 47,684