Mount external hard drive with r/w permissions for minidlna

7,500

The problem is your partition is mounted via fuse. That's not the same as mounting a filesystem native.

Use that command:

sudo mount -t ntfs-3g /dev/sda1 /home/pi/dd -o uid=1000,gid=1000

That should set the partition's user and group to pi.

Share:
7,500

Related videos on Youtube

Hilo
Author by

Hilo

Updated on September 18, 2022

Comments

  • Hilo
    Hilo over 1 year

    I trying to mount my external hard drive (NTFS) on my raspberry pi in /home/pi/dd

    But I would like to have r/w access to all files on this HD because I want to use one of its subfolders with minidlna: example on /etc/minidlna.conf:

    media_dir= /home/pi/dd/a_folder
    

    Actually chown and chmod doesn't work after the mount...

    Example of what I did:

    pi@raspberrypi - ~ sudo cat /etc/passwd
    pi:x:1000:1000:,,,:/home/pi:/bin/bash
    minidlna:x:107:110:MiniDLNA server,,,:/var/lib/minidlna:/usr/sbin/nologin
    
    pi@raspberrypi - ~ sudo cat /etc/fstab
    proc                    /proc           proc    defaults                                0       0
    /dev/mmcblk0p5          /boot           vfat    defaults                                0       2
    /dev/mmcblk0p6          /               ext4    defaults,noatime                        0       1
    UUID=0A1C40D81C40C105   /home/pi/dd     ntfs-3g uid=1000,gid=1000                       0       2
    
    pi@raspberrypi - ~ ll
    total 12K
    drwxr-xr-x 2 pi pi 4,0K janv. 30 10:18 backup_files
    drwxr-xr-x 2 pi pi 4,0K janv. 30 10:17 dd
    drwxr-xr-x 2 pi pi 4,0K déc.  24 12:34 Desktop
    
    pi@raspberrypi - ~ sudo mount /dev/sda1
    
    pi@raspberrypi - ~ ll
    total 24K
    drwxr-xr-x 2 pi   pi   4,0K janv. 30 10:18 backup_files
    drwxrwx--- 1 root 1004  16K janv. 30 07:43 dd
    drwxr-xr-x 2 pi   pi   4,0K déc.  24 12:34 Desktop
    

    We can see the line:

    drwxrwx--- 1 root 1004  16K janv. 30 07:43 dd
    

    This (I think) cause the fail of minidlna start:

    pi@raspberrypi - ~ sudo service minidlna force-reload
    [....] Restarting DLNA/UPnP-AV media server: minidlna[2015/01/30 10:57:31] minidlna.c:474: error: Media directory "/home/pi/dd/Downloads/Music" not accessible! [Permission denied]
    [2015/01/30 10:57:31] minidlna.c:474: error: Media directory "/home/pi/dd/Downloads/Films" not accessible! [Permission denied]
    . ok
    

    And when I chmod or chown dd folder, nothing change the folder owner/rights don't change...

    I think that I don't understand really well mount options...

    Thank you for your help

    EDIT: Here is the result of "sudo cat /proc/mounts"

    pi@raspberrypi - ~ sudo cat /proc/mounts
    rootfs / rootfs rw 0 0
    /dev/root / ext4 rw,noatime,data=ordered 0 0
    devtmpfs /dev devtmpfs rw,relatime,size=219744k,nr_inodes=54936,mode=755 0 0
    tmpfs /run tmpfs rw,nosuid,noexec,relatime,size=44784k,mode=755 0 0
    tmpfs /run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k 0 0
    proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
    sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
    tmpfs /run/shm tmpfs rw,nosuid,nodev,noexec,relatime,size=89560k 0 0
    devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
    /dev/mmcblk0p5 /boot vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro 0 0
    /dev/sda1 /home/pi/dd fuseblk rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096 0 0
    

    EDIT 2: I forgot to say that I share this folder /home/pi/dd with samba, here is the configuration file:

    [global]
       workgroup = WORKGROUP
       server string = %h server
       netbios name = Naspi
       dns proxy = no
       log file = /var/log/samba/log.%m
       max log size = 1000
       syslog = 0
       panic action = /usr/share/samba/panic-action %d
       security = user
       encrypt passwords = true
       passdb backend = tdbsam
       obey pam restrictions = yes
       unix password sync = yes
       passwd program = /usr/bin/passwd %u
       passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
       pam password change = yes
       map to guest = bad user
       usershare allow guests = yes
    
    [Nas]
       path =/home/pi/dd
       read only = no
       locking = no
       guest ok = yes
       force user = pi
    
    • chaos
      chaos over 9 years
      Can you post the output of sudo cat /proc/mounts while the partition is mounted?
    • Hilo
      Hilo over 9 years
      Yes, I just added it to my post ;)
  • Hilo
    Hilo over 9 years
    That works perfectly :) (If I replace sda5 by sda1 :p) But how can I do to do that with the fstab file ?