Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
ntfs3g as a regular user
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
jyoung
Guru
Guru


Joined: 20 Mar 2007
Posts: 436

PostPosted: Wed Dec 08, 2021 11:13 pm    Post subject: ntfs3g as a regular user Reply with quote

I'm trying to mount an ntfs external usb drive as a regular user, and I'm having some trouble:

Code:
Error opening read-only '/dev/sdd1': Permission denied
Failed to mount '/dev/sdd1': Permission denied
Please check '/dev/sdd1' and the ntfs-3g binary permissions,
and the mounting user ID. More explanation is provided at
http://tuxera.com/community/ntfs-3g-faq/#unprivileged


ntfs-3g is installed with suid and mount-ntfs enabled. As root, I'm able to mount the device without difficulty. I'm also able to mount the device as a non-root user if, as root, I first chmod a=rwx on the device (in this case, /dev/sdd1). However, when I unplug it and plug it back in, the permissions return to their previous state.

FUSE and NTFS read/write are enabled in the kernel.

There are a lot of threads, including some gentoo threads, relating to this topic, but the majority seem to be cases where it's not possible to mount even as a root. There are a few which suggest modifications to udev rules as a solution, which seems align with the symptoms I'm seeing. However, I'm not very udev fluent, and directly duplicating their solutions has not been fruitful.

The website that's mentioned in the error messsage is also not helpful (at least, as far as I can tell). That link points to the ntfs-3g main page, which makes no mention of unprivileged access, and searching for "unprivileged" on that site returns zero hits.

I would be greatful for any help!


Last edited by jyoung on Thu Dec 09, 2021 1:22 am; edited 1 time in total
Back to top
View user's profile Send private message
jpp_
Tux's lil' helper
Tux's lil' helper


Joined: 23 Oct 2009
Posts: 110
Location: Argentina

PostPosted: Thu Dec 09, 2021 12:27 am    Post subject: Reply with quote

Hello jyoung

Dont know if this apply to your issue, but i manage to mount ntfs with polkit rules

Code:
/etc/polkit-1/rules.d/10-admin.rules


Code:
polkit.addAdminRule(function(action, subject) {
    return ["unix-group:wheel"];
});
polkit.addRule(function(action, subject) {
   if ((action.id == "org.freedesktop.udisks.filesystem-mount-system-internal")) {
       return polkit.Result.YES;
    }
});
polkit.addRule(function(action, subject) {
   if ((action.id == "org.freedesktop.udisks2.filesystem-mount")) {
        return polkit.Result.YES;
    }
});
polkit.addRule(function(action, subject) {
   if ((action.id == "org.freedesktop.udisks2.filesystem-mount-other-seat")) {
        return polkit.Result.YES;
    }
});
polkit.addRule(function(action, subject) {
   if ((action.id == "org.freedesktop.udisks2.filesystem-mount-system")) {
        return polkit.Result.YES;
    }
});
polkit.addRule(function(action, subject) {
   if ((action.id == "org.freedesktop.udisks2.filesystem-unmount-others")) {
        return polkit.Result.YES;
    }
});
Back to top
View user's profile Send private message
jyoung
Guru
Guru


Joined: 20 Mar 2007
Posts: 436

PostPosted: Thu Dec 09, 2021 1:22 am    Post subject: Reply with quote

juampii, thanks for the suggestion. I just adopted that set of polkit rules, and restarted udev

Code:
 /etc/init.d/udev restart


but alas to no effect. Were you getting a similar error prior to adopting those polkit rules?
Back to top
View user's profile Send private message
jyoung
Guru
Guru


Joined: 20 Mar 2007
Posts: 436

PostPosted: Thu Dec 09, 2021 1:31 am    Post subject: Reply with quote

Wait, would restarting udev even affect polkit? There's no item that looks like polkit /etc/init.d. Hmm... my make.conf file also doesn't have

Code:
USE="policykit"


although polkitd is running in the background. I must admit that I haven't tinkered with polkit.
Back to top
View user's profile Send private message
jpp_
Tux's lil' helper
Tux's lil' helper


Joined: 23 Oct 2009
Posts: 110
Location: Argentina

PostPosted: Thu Dec 09, 2021 2:44 am    Post subject: Reply with quote

jyoung wrote:
Were you getting a similar error prior to adopting those polkit rules?


Yes, but im using nemo in a custom de, it uses gvfs i believe, to mount my external ntfs drives.
Also i have emerged ntfs3g with USE="acl mount-ntfs ntfsprogs xattr -debug -ntfsdecrypt -static-libs"

and unset
Code:
CONFIG_NTFS_FS
CONFIG_NTFS3_FS


and
Code:
CONFIG_FUSE_FS: Y


https://wiki.gentoo.org/wiki/NTFS

But in the wiki says:
Quote:
Important Before Linux v5.15, the mainlined old NTFS kernel driver had very limited functional support for NTFS. The kernel configuration information defines support as "partial, but safe". The old driver could overwrite existing files but is not capable of file or directory creation, deletion, or renaming. Most NTFS users will want to enable the FUSE-powered NTFS-3G implementation for systems running pre-v5.15 kernels.


So maybe your aproach is better than ntfs3g,.

edit: and for the rules, you need to be in the wheel group

Have a nice day
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum