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.
Distribution: Formerly Various Linux Distros, Now Fixed on Fedora 32
Posts: 189
Rep:
Accessing MSDOS files from Linux
Hi All,
I have a dual-boot Win98 / RedHat Fedora Core Linux system.
I am able to access the files on the Win98 partiton (separate HD actually) by adding the following line to my /etc/fstab file:
/dev/hda1 /mnt/msdos vfat defaults 0 3
I have no idea whether or not this is the approved way of doing things - but it works... Well kind of. The problem is that while I can access the files I can only write to them when logged in as root.
If I look at the permissions I see the following:
[mark@localhost mark]$ ls -l /mnt
total 24
drwxr-xr-x 2 root root 4096 Mar 27 10:01 cdrom
drwxr-xr-x 2 root root 4096 Mar 11 21:08 floppy
drwxr-xr-x 12 root root 16384 Jan 1 1970 msdos
Attempting to change permissions (even as root) I get :
[root@localhost mnt]# chgrp super msdos
chgrp: changing group of `msdos': Operation not permitted
(super is a group I created with my user account as a member)
or
[root@localhost mnt]# chmod g=rwx msdos
chmod: changing permissions of `msdos' (requested: 0775, actual: 0755): Operation not permitted
How do I set things up so that I can read, *write", and execute files on my MSDOS disk from a user account in Linux - but only the user account I specify?
I think you're looking for the "user" option, which will allow your FAT partition to be user-mountable (perms default to whatever user mounted the partition). You might also try out "users", although it's not as secure. If you have your partition setup to be mounted at boot, it should end up being mounted by root. Without using the "users" option, you can use "rw" to allow the partition to be mounted with read/write perms for everyone.
Here's an example fstab entry:
/dev/hda1 /fat vfat user,rw,exec 0 0
I'd suggest checking out "man fstab" (or "man:/fstab" if you have Konqueror), as well as "man mount". If you have a user-friendly distro (i.e Mandrake), I'd also recommend configuring your partitions through its configuration utility. A great distro-independent config util is "linuxconf". It configures /etc/fstab among other things.
try
chown mememe:msdos /mnt/msdos
chmod 1770 /mnt/msdos
or
chmod 770 /mnt/msdos
(the 1 only tell it to set the archive bit, something i like to do just for fun, 0770 is normally what most distros would take)
the chown changes the user and group to some other user (make it whatever you want) and the group to msdos (like you said to do)
also you can try
chown :msdos /mnt/msdos
instead, this doesn't change the user, but changes the group owner, try whatever you want
ill assume you know what the chmod command does if not:
770 = the owner of the file gets full access, the group gets full access, and everyone else gets nothing!
Distribution: Formerly Various Linux Distros, Now Fixed on Fedora 32
Posts: 189
Original Poster
Rep:
OK guys, you're going to have to go easy on me because I am still a little wet behind the ears when it comes to Linux...
I tried umount and then changing the permissions and it worked!
The trouble is, as soon as I reboot it all gets set back to how it was.
I tried changing the entry in /etc/fstab in a variety of different ways but it always seems to end up as owner=root, group=root when I do ls -l.
Essentially what I want to achieve is this:
The MSDOS drive is mounted at boot-up;
Anyone can have read access to anything in that drive;
Anyone in group "super" can have rwx access;
I have root + my user account in group "super".
What exactly to I have to put into /etc/fstab to achieve this - or is what I am trying to do not possible?
Distribution: Formerly Various Linux Distros, Now Fixed on Fedora 32
Posts: 189
Original Poster
Rep:
Quote:
Originally posted by ArthurDent .... and it worked!
Erm... actually I think it only worked because I was, Ahem, logged in as root... Sorry, I got confused with all the switching back and forth.
It seems that if I umount the dive I can change the permissions of /mnt/msdos, but the act of re-mounting the drive, either manually or by fstab at re-boot, resets the permissions back to root...
Can anyone think of a way of doing waht I want to do?
ok, it looks like your distro has some weird startup procedure that resets everything then (or did you do a proper shutdown?..lol), so look at the boot scripts in /etc/rc.d (or wherever your distro puts them), and search thru all the files files for the use the "chmod" command
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.