Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Change the settings of fmask and dmask in /etc/fstab. Fat32, and NTFS filesystems are not native to Linux. So you need to set the permissions in your mount command options or the fstab entry.
# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc nodev,noexec,nosuid 0 0
# / was on /dev/sda8 during installation
UUID=06ecf0b7-ab12-4ada-82dc-d3267d45ad21 / ext4 errors=remount-ro 0 1
# swap was on /dev/sda14 during installation
UUID=1414ee34-775a-4ca6-a196-5e23b09f07a8 none swap sw 0 0
# swap was on /dev/sda15 during installation
UUID=49343515-0b63-46b5-8244-96cba544ade2 none swap sw 0 0
/dev/sda7 none swap sw 0 0
UUID=a20a4466-24bc-42c5-93e2-2193e99847b5 /mnt/1 ext2 rw 0 0
UUID=1c1bc84c-9ef5-4daa-a630-8fe29b5d12d1 /mnt/jaunty ext2 rw 0 0
~
I do not see the USB here at all.In fact in Ubuntu you do not need to mount or unmount the USB it automatically (I don't know how) does that.
Which entry in above you are referring as fmask dmask?
I don't use Ubuntu and don't normally use Gnome. I think if you right click on the disk icon, and select properties, there may be an advance settings options to set the default permissions of the disk. I made some searches on Google, and gconftool was used, but the keys mentioned aren't used on SuSE. Things dealing with udev, hal & policy kit can vary between distro's and distro versions. Ironically making things easier, involves adding a lot of complexity. Sometimes the old-school method is actually easier.
You could create your own entry in /etc/fstab. First find out the UUID of the filesystem with "sudo blkid". You can also list the disk/by-uuid device nodes. "ls -l /dev/disk/by-uuid"
Then use "UUID=<UUID number>" in the first field. Here is an example using a pendrive:
You can leave out noatime if you aren't using a pendrive. It will extend the life of the flash memory by not updating the access time after reading a file.
Now "sudo mount /mnt/pendrive" will mount this pendrive with 0755 permissions for files & directories. You might consider using fmask=0133 instead to mask out the "x" bit on files for removable devices.
One advantage of an entry using the UUID or LABEL in fstab is that you can have different devices mounted differently. Add the option "users" and you don't need to use sudo to mount the pendrive. A regular user can mount it, but the ownership and permissions will be set in the fstab entry. If you use dmask=077,fmask=066 another user (without sudo permissions) can mount but not use the pendrive (on the same computer). While this won't prevent mounting the pendrive on a different computer, it can help prevent accidental access by someone sharing the computer.
I don't use Ubuntu and don't normally use Gnome. I think if you right click on the disk icon, and select properties, there may be an advance settings options to set the default permissions of the disk.
I checked there was no advance permissions thing and infact what I saw in permissions tab was permissions could not be determined.
Quote:
Originally Posted by jschiwal
One advantage of an entry using the UUID or LABEL in fstab is that you can have different devices mounted differently.
Apparently, the permissions tab is intended for files. On a previous version of KDE, I was able to right click on a disk icon, and change the way it was mounted automatically.
---
The UUID of a filesystem is unique to only that file system. It stands for "Universal Unique IDentifier".
The fstab entry won't be used for another removable drive you plug in. A different pendrive will mount automatically as before.
To test my post, I changed the fstab entry to:
UUID=7479-7F2E /mnt/pendrive vfat rw,nosuid,nodev,uhelper=hal,uid=1000,gid=1000,user,shortname=mixed,dmask=0022,fmask=0022,utf8=1,noat ime,flush
I also created a new user. As that user I entered the command:
mount /mnt/pendrive
The pendrive mounted with these permissions:
drwxr-xr-x 3 jschiwal jschiwal 16384 1969-12-31 17:00 /mnt/pendrive
Change the fstab entry like this:
UUID=7479-7F2E /mnt/pendrive vfat rw,nosuid,nodev,uhelper=hal,uid=1000,gid=1000,user,shortname=mixed,dmask=0077,fmask=0077,utf8=1,noat ime,flush
It is mounted with these permissions:
drwx------ 3 jschiwal jschiwal 16384 1969-12-31 17:00 /mnt/pendrive/
Suppose you share your computer with a roommate. Your roommates pendrive will have a different UUID number and you can create another entry for it.
UUID=7479-E32E /mnt/pendrive vfat rw,nosuid,nodev,uhelper=hal,uid=1001,gid=1001,user,shortname=mixed,dmask=0022,fmask=0033,utf8=1,noat ime,flush
The pendrive will be mounted with your roommate being the owner. As an "other" user, you will be able to read files, but not write to them.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.