Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

vfat permissions problem?

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
JBB
Posts: 2
Joined: 2005-03-03 19:17

vfat permissions problem?

#1 Post by JBB »

I switched from Mandrake to Debian because I wanted to learn more about Linux; the games have begun! huzzah!

Debian Sarge, xterm, bash, KDE
Linux version 2.4.27-2-686

Below was my original problem:
****************
I am having trouble mounting my Windows hard drive as a user. No problems as root. <mount -t vfat /dev/hda1 /mnt/Win98>

<cd /mnt/Win98> gets me: "bash: cd: /mnt/Win98: Permission denied"

When I enter <ls -l /mnt/Win98> as a normal user I get bunch of permission denied.

If I enter <ls -l> from /mnt as normal user I can then view the directory's attributes which are:
"drwxr--r-- 43 root root 4096 2005-02-23 12:25 Win98"

When I enter <ls -l /bin/mount> the attributes displayed are:
"-rwsr-xr-x 1 root root 76888 2004-09-23 23:34 /bin/mount"

When I enter the command as normal user <mount -t vfat /dev/hda1 /mnt/Win98> I get: "mount: only root can do that". Looking at the attributes for mount I don't understand why I can't use it. Also, <type mount> = "mount is hashed (/bin/mount)".

Now I am going to <su>...done.

Enter <mount -t vfat /dev/hda1 /mnt/Win98> I get the message:
"mount: according to mtab, /dev/hda1 is already mounted on /mnt/Win98". So it seems to be mounted at bootup.

Exit su (Ctrl-d).

As root I have tried:
<chmod ugo=xrw /mnt/Win98>
<chmod 777 /mnt/Win98>
<find /mnt/Win98 -type d exec chmod 777 {} \;>

Know matter what I do, I can view /mnt/Win98 as root only. I have searched and searched, but nothing seems to work. This is driving me crazy. Is there a text file I can manually enter the permissions into?
****************************

This is a line I had in /etc/fstab while experiencing the above problem:
/dev/hda1 /mnt/Win98 vfat ro,user,auto 0 0

A change was suggested, so I commented out the above line and added:
/dev/hda1 /mnt/Win98 vfat user,exec,dev,suid,rw,unmask=000,auto 0 0

This change did mount /mnt/Win98 on bootup, and allows a normal user access to /mnt/Win98, but no files can be "seen". The same is now true for root.

After this change the attributes for /mnt/Win98 are now:
drwxr-xr-x 2 root root 1024 2005-03-01 17:38 Win98

Edit: This seemed odd to me: As root, I typed /etc/fstab, hit enter, and got a permission denied message.

Thank You
JBB
In Pursuit of Reason

lacek
Posts: 764
Joined: 2004-03-11 18:49
Location: Budapest, Hungary
Contact:

#2 Post by lacek »

Unfortunately, the FAT-type filesystems don't have even a nearly sane permission structure. Either a user can read AND write, or not.
Thus, you need to mount the filesystem in a way your user be able to see it, with this command:

Code: Select all

mount /dev/hda1 /mnt/Win98 -t vfat -o uid=<your_user_name_of_UID>
You may enter it to the fstab, using this line:

Code: Select all

/dev/hda1     /mnt/Win98     vfat     uid=<your_user>,user
After this, you can mount it with your user, using just this command:

Code: Select all

mount /mnt/Win98
but it will be auto-mounted on startup (use the 'noauto' flag to prevent this).

About the permission denied "problem": You tried to RUN /etc/fstab (by simply entering its name, much like if you said /bin/bash). Since fstab is not an executable file, permission for execute is denied.

JBB
Posts: 2
Joined: 2005-03-03 19:17

#3 Post by JBB »

lacek

Thank you for your reply, later today, time permitting, I'll try your suggestions.

The thing I'd like to know is how Mandrake(9.2) got around this problem. When I had Mandrake installed I was able to view my vfat drive as a normal user or root without having to configure anything. In the future, as my knowledge increases, maybe I'll get it figured out.

Thanks again
JBB
In Pursuit of Reason

lacek
Posts: 764
Joined: 2004-03-11 18:49
Location: Budapest, Hungary
Contact:

#4 Post by lacek »

Altough my interaction with Mandrake was a
<flame>
thankfully
</flame>
short one, the first thing I spotted is that Mandrake uses several daemon processes (as well as many kernel enhancements) to 'hide' certain config elements from the user, thus making it more easy use things such as FAT filesystems.
But believe me: Mandrake used effectively the same thing, however, it detected your user and mounted the FAT partition to allow access to your user as a default.

buster
Posts: 9
Joined: 2005-03-05 04:25

#5 Post by buster »

I have a similar problem with a second hdb. I would like it to be available to users after the boot, with no mount needed. It is mounted at / in the form /TransferHD. It mounts, can be used in root, but I've not managed to get it viewable as a user. Here is what I have in part of my fstab so far:

/dev/hda6 / reiserfs notail 0 1
/dev/hda8 /home reiserfs defaults 0 2
/dev/hdb5 /transferhd vfat defaults 0 2
/dev/hda7 none swap sw 0 0

It looks the same as /home, but doesn't act the same way. Any help appreciated.

lacek
Posts: 764
Joined: 2004-03-11 18:49
Location: Budapest, Hungary
Contact:

#6 Post by lacek »

would like it to be available to users after the boot, with no mount needed.
Mounting a filesystem is needed in order to use it. The fstab line you need is in my previous post.

buster
Posts: 9
Joined: 2005-03-05 04:25

#7 Post by buster »

Thanks for the help. But....

In my Mepis system, which is basically Debian testing, I have this line in my fstab, and when I click on /storage2 as a user I have the ability to use files of music etc.

/dev/hdb5 /storage2 vfat auto,users,exec,umask=000 0 0

I assumed from looking at the fstab in Debian Sarge that the ways of writing this stuff are different from Mepis. Please note I do not have to mount it as a user. After boot I have full access. Are you suggesting I can't do this with Sarge? Any help appreciated.

lacek
Posts: 764
Joined: 2004-03-11 18:49
Location: Budapest, Hungary
Contact:

#8 Post by lacek »

You obviously missed the "it will be auto-mounted on startup" part in my post. If you use that line in the fstab, the filesystem will get mounted upon system boot.
To my knowledge, this is the only way to access a filesystem without using daemons to continuously check the devices and kernel enhancements (which are used by Manrake).
I don't know much about Mephis, so it may use some enhancements like this. Also note that if a system is "basically" Debian, it may still be entirely different.

buster
Posts: 9
Joined: 2005-03-05 04:25

#9 Post by buster »

"You obviously missed the "it will be auto-mounted on startup" part in my post." I can throw a rock at the side of a barn and miss. :lol: Thanks for your help. I'll try a line similar to the Mepis one. If you know nothing about Mepis, you might look at this. It's an easy read, with pictures even.

http://www.plugintolinux.ca/simplymepis_review.html

I'm trying Debian 'pure' because I think I should know more about the greatest linux system. But it can be a trial at times.

Post Reply