How to mount a drive for other user than root?

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.


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.

          <snip>

          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.