Since changing my uid I no longer have the permissions to see a USB hardrive/stick that is automatically mounted at /media/USERNAME.

Nautilus gives the message

Unable to open a folder for DRIVENAME

No application is registered as handling this file

If I log on as root in a terminal I can see that the drive is mounted in the proper location and can access the files.

Does someone know what I need to do to make it so that I can use the mounted drive with my non-root user?

With other users on the system everything works as expected.

  • 1) You should edit your post by clicking the small light gray button below it on the left, instead of adding comments to improve the readability of your post. 2) Please post the output of cat /etc/fstab (as an edit). Thank you! – Byte Commander Feb 9 '15 at 10:11
  • I'm having this exact same problem! – StFS Feb 9 '15 at 15:26
up vote 5 down vote accepted

I managed to solve this problem by unmounting all USB disks I had plugged in and deleting the /media/username directory.

Then, when I plug in my USB stick again, the directory gets re-created and all is good.

Before reading on, you may want to refer to this article, it explains the process of changing your UID, and draws attention on how to assign a new UID to your user the correct way.

"Please note that all files which are located in the user’s home directory will have the file UID changed automatically as soon as you type above two command. However, files outside user’s home directory need to be changed manually."

With that said. Your UID will not be changed automatically for any files outside of your /home/USER directory.

In order to regain access to your drive mounted in the users /media/USER directory, once again, I recommend following the above article to make sure you correctly changed the UID of all your files both in and out of '/home/USER`, so naturally your drive should be plugged in.

Here is the code provided on the article mentioned above:

To assign a new UID to user called foo, enter:

# usermod -u NEWUIDHERE foo

To assign a new GID to group called foo, enter:

# groupmod -g NEWGIDHERE foo

To manually change files with old GID and UID respectively: (Outside of your home directory)

# find / -group NEWUIDHERE -exec chgrp -h foo {} \;
# find / -user NEWGIDHERE -exec chown -h foo {} \;

"The -exec command executes chgrp or chmod command on each file. The -h option passed to the chgrp/chmod command affect each symbolic link instead of any referenced file. Use the following command to verify the same"

# ls -l /home/foo/
# id -u foo
# id -g foo
# grep foo /etc/passwd
# grep foo /etc/group

Thank you to Vivek Gite for this wonderful article! Hope this helps you.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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