I've attached a SSD disk though USB. Then:

 sudo su -
 mkdir /mnt/hx
 chown ondra /mnt/hx
 mount /dev/sdb1 /mnt/hx  # It's FAT32 now, but was the same with EXT4

The last command changes dir owner to root. Whenever I create a file in the root dir, I need to be root and root is the owner.

Can I set different user as owner of the mounted dir? Or, simply said, ensure that user XY can freely read/write on the drive.

  • Why don't you just sudo mkdir -p /mnt/hx then sudo mount /dev/sdb1 /mnt/hx? Sep 20, 2012 at 20:24
  • Seems like it's the uid=1000,gid=1000 options Sep 20, 2012 at 20:28
  • You gotta do a sudo chown -R username:groupname /folder. The -R makes the chown permissions be applied recursively. Also check the chmod, even that takes the -R parameter. Sep 20, 2012 at 20:32

1 Answer 1


Gnome-based GUI environment

gio mount -d /dev/sdb1

Easy as that.

For older versions of Gnome you may need to use gvfs-mount instead:

gvfs-mount -d /dev/sdb1

Headless (no GUI) machine

Add an entry in /etc/fstab and specify options for it.

From the manpage of fstab:

   The fourth field (fs_mntops).
          This field describes the mount options associated with the filesystem.


          user   allow a user to mount
          owner  allow device owner to mount

Now you'll need to make sure the device is owned by the correct owner. Specify that in an udev rule. Put a file in /etc/udev/rules.d/50-myhdd-ownerchange.rules:

SUBSYSTEMS=="usb", ATTRS{idVendor}=="0bb4", ATTRS{idProduct}=="0ff9", MODE="0600", OWNER="username"

Replace the vendor and product ids with the USB device you want to get triggered by it. Find them using the command lsusb. Also change the MODE if you like.

Alternatively, use pmount. I don't like it, personally.

  • I have mounted it succesfully. But now I can't exec executable files, not even with exec amongst options. Sep 20, 2012 at 21:34
  • @OndraŽižka Are you sure about the order of options you gave in the fourth field? The example in the manpage mentions user,exec. AFAIK if you would do exec,user, then user will override the exec option with its implication noexec. If it still does not work, please share the relevant line in /proc/mounts.
    – gertvdijk
    Sep 20, 2012 at 21:49
  • +1 for pmount, I didn't have any luck with gvfs.
    – pydsigner
    May 19, 2016 at 3:18
  • gvfs-mount has been replaced with gio mount in current versions of Gnome. Nov 29, 2019 at 22:50
  • @DavidKennedy Thanks, added.
    – gertvdijk
    Dec 4, 2019 at 11:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.