Linux: Mount Folder using own Name and Rights (not Root)
Question by Guest | Last update on 2022-12-03 | Created on 2018-01-31
I would like to include or mount a folder with my own user name and accordingly also with my own rights on Linux.
So far, I'm using the following mount command:
mount -t vboxsf hdir /home/me/Desktop/gdir
This mounts the external folder "hdir" (hostdir) on my desktop to the folder "gdir" (guestdir).
This works so far, but this leads to the fact that owner and group is set to "root". However, I would like to have my own username and my own group instead of "root". Is that possible?
Related Topics
Rename File to its Folder Name
Tutorial | 0 Comments
Linux: Mark Program File as executable
Tutorial | 0 Comments
VirtualBox: Change Date and Time
Tutorial | 10 Comments
VirtualBox: Shared Folder not visible on Linux/Ubuntu
Question | 2 Answers
Release of Debian Packages, RPM Packages and Binaries for Linux
Blog | 0 Comments
Linux/Ubuntu: Run Terminal Command as Root
Question | 1 Answer
XAMPP: How to set up SSL/HTTPS for local Projects
Tutorial | 4 Comments
Important Note
Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.
Participate
Ask your own question or write your own article on askingbox.com. That’s how it’s done.
You can pass your own user ID (UID) and group ID (GID) as an option to the mount command. Then you will be the owner of the mounted folder:
Here we added "-o uid=1000,gid=1000" to the command. The "-o" introduces the options, which are listed behind comma separated. The user ID (UID) is set to 1000 here, the group ID (GID) also to 1000.
The UID 1000 is automatically assigned to the first created user under Ubuntu. With the command id you can find out your own user ID from the terminal and insert it accordingly into the command (instead of 1000 if you have a differing ID).
You can also add the option "umask" with which you can restrict the access rights:
With "umask=022" you set the rights to a maximum of 755 (777 - 022 = 755). If you want to define different permissions for folders and files you can use the options fmask and dmask instead of umask.
With "fmask=022,dmask=000" you set the rights to a maximum of 755 for files (f stands for files) and 777 for folders (d stands for directories). Leaving these options aside, will by default use 022 for FAT file systems and 000 for NTFS file systems.
Last update on 2022-12-03 | Created on 2018-01-31