7

I realised that Ubuntu automatically mounts my internal drives which are some exFats automatically when I try to open them. Thats good.

However, it is mounted as "root" and I want to mount it as my current user. Is there any way to make it mount not as root through some configurations or do I have to do it as a command?

Thanks

3 Answers 3

4

Software to run exFAT

Depending on the version of Ubuntu or Ubuntu based operating system you may or may not need to install the following program packages,

sudo apt-get install exfat-utils exfat-fuse

See this link for more details,

How do I copy a file larger than 4GB to a USB flash drive?

Mounting exFAT

Many versions of Ubuntu and Ubuntu based operating systems will mount Microsoft file systems (FAT32, exFAT, NTFS) with read/write permissions automatically for root as well as the current user.

But some versions (of Ubuntu and Ubuntu based operating systems) will mount them with write permissions only for root (or not at all). Then you can unmount and remount (mount) the file system with commands like this,

Create mountpoint (only if you want a new mountpoint)

sudo mkdir -p /mnt/sd1

Unmount (only if already mounted)

sudo umount /dev/sdxn   # general syntax
sudo umount /dev/sdb1   # modify to match your case

Check your userID's uid number (it is usually 1000, sometimes 1001 or 1002 ...)

grep ^"$USER" /etc/group

and use that number if you want to grab ownership (default is root).

Example of mount command line that should give you something that is close to what you want,

sudo mount -o rw,users,uid=1000,dmask=007,fmask=117 /dev/sdxn /mnt/sd1  # general syntax
sudo mount -o rw,users,uid=1000,dmask=007,fmask=117 /dev/sdb1 /mnt/sd1  # modify to match your case

See this link for more details,

How to change default permissions on automounted usb flash, formatted in NTFS?

2
  • But how to mount automatically when pluged in or after boot?
    – Felipe
    Mar 18, 2021 at 5:17
  • @Felipe, You can add a line in /etc/fstab with the relevant mount options for the partition with the exFAT file system. You find advice at man fstab - The mount options should be in the fourth field of that line.
    – sudodus
    Mar 18, 2021 at 6:51
0

It seems like the default automount behaviour which is provided by gnome features does not have so much possibility for configuration.

What you want to do, is you add mount option umask=0, which can be done if configured in /etc/fstab like this:

/dev/sda1 /media/usbdrive exfat rw,async,umask=0 0 0

This kind of goes against the automount concept though, since it means static configuration.

It could probably be achivied by using automount and autofs though:

https://help.ubuntu.com/community/Autofs

If you chose this path, then you should disable the automount option in gnome:

https://help.ubuntu.com/community/Mount/USB#Configuring_Automounting

1
  • 1
    I don't have a /etc/fstab file (Ubuntu 14.10). Jan 4, 2015 at 11:33
0

Execute Rights, Least Access & Automount

In addition to the other answers, after you have checked your uid, drive uuid, and made your mountpoint folder—but if you also want your user to have execute rights on the drive to run scripts or applications stored on the drive and you would like to restrict access to only your user, usually for servers or computers that grant ssh access, or have other user services running, or plainly for general security and least access—then you should modify the mount as:

sudo mount -o rw,exec,uid=1000,umask=007 /dev/sdxn /mnt/sd1

with your uid, /dev/ and /mnt/mountfolder .

'rw' for read/write; 'exec' for execute rights; and 'dmask=007,fmask=007' is synonymous with 'umask=007', which un-masks the rw+exec rights from 'all' users for directories and files, but allows the permissions for owner (the uid) and group (should always end up being root)

Automount exFat accessible for one User+Root rwx access

sudo-edit your /etc/fstab. You can confirm the location of the fstab file with

man fstab #look under "Synopsis"
sudo nano /etc/fstab

And add a line with the automount instructions of format

# <file system> <mount point> <type> <options>                        <dump>  <pass>
UUID=FDB9-7531  /mnt/mydrive  exfat  rw,exec,auto,uid=1000,umask=007  0       0

.. with your own UUID, mount folder, and uid as @sudodus detailed. 'auto' is added here so you can immediately test the automount without rebooting:

sudo systemctl daemon-reload
sudo mount -a

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .