MandrivaThis Forum is for the discussion of Mandriva (Mandrake) Linux.
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.
I want to be able to write files outside of my /home directory, more precisely, onto my second hard disk, /media/hd on my system. Having just read up about chown, I ran "chown -R stuart.stuart hd" at the command line (at the media directory), but got a 'permission not allowed' error at each file and directory listing.
Then I learnt about chmod, which not did I think more suitable, seemed in its output at least, to have worked, giving me a 'changed permissions' message, now at (777) rwxrwxrwx (I had typed "chmod -vR a+w hd".) Listing the directory (ls -l) showed all was as before - no change.
I did all of this as root, so don't why no changes occur. Any ideas?
media/hd only ever mounts when I click on drive icon in KDE, if not this, when I do it myself (mount -t vfat /dev/hdb1 /media/hd)
Each has the same effect. In Windows at the moment, don't know if it's etc/fstab is related but sometimes I see a different location in KDE, something like: media:hdb1
I don't know anything about etc/fstab, but am willing to take a brief lesson.
I get this:
[root@localhost stuart]# mount
/dev/hda5 on / type ext3 (rw)
none on /proc type proc (rw)
/dev/hda7 on /home type ext3 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
Here's what I got earlier on today when running chmod:
Well, mount shows that only /dev/hda is mounted, no /dev/hdb, so you are only seeing the mountpoint directory on /dev/hda contents and not anything from /dev/hdb1 as it is not there. The message "permission not allowed" also means in this case "File not found".
Oops! Forgot to mount before getting that output. Here's the extra (and only other) line you'd perhaps expected:
/dev/hdb1 on /media/hd type vfat (rw)
So a re-writeable fat 32 partition, as would have been yesterday when running the chmod and chown commands. No surprise to me, but it is perhaps significant I am using a vfat formatted drive? Or is the failure related to something else?
It shows rw so it should be writeable if you have proper permissions. I don't know ANYTHING about windows as I came from OS/2 directly to linux. I know my stick is formatted as fat and I can read and write to it. Perhaps some maven will see this thread and help you.
Dave
I don't think that it's possible to change permissions on files on a vfat partition, since vfat doesn't understand unix permissions. I don't use windows at all any more but this is what I have in my notes:
Quote:
Set the fstab entry to be similar to
/dev/sda1 /mnt/backup vfat defaults,users,umask=0,iocharset=iso8859-15,codepage=850 0 0
The users option allows anyone to mount it.
The umask=0 sets everything in the file system to world writeable,
so that anyone can write to it.
Success! I changed my etc/fstab file from umask=0022 to umask=0, but had to go one extra step: mounting the filesystem as normal, "mount /dev/hdb1" (or not so normal; hitherto I always ran "mount -t vfat /dev/hdb1 /media/hd") I still got the same old permissions when running ls-l. I checked the man page for mount and saw this option:
-f Causes everything to be done except for the actual system call;
if it's not obvious, this ‘‘fakes'' mounting the file system.
This option is useful in conjunction with the -v flag to deter‐
mine what the mount command is trying to do. It can also be used
to add entries for devices that were mounted earlier with the -n
option. The -f option checks for existing record in /etc/mtab
and fails when the record already exists (with regular non-fake
mount, this check is done by kernel).
I faked a mount (mount -f /dev/hdb1), and so was then able to change group and user ownership of the files in /hd (chown -R stuart:stuart hd), and write the fstab changes, I guess because my drive was not invoked as it would have otherwise been with a regular mount. Because mount was faked, strictly, the files and directories weren't at the the hd mount point at this time, but I guess a flag was set (think that's the right term), so that when I did mount proper, the permissions had been altered as expected, (rwxrwxrwx as per umask=0). Group and user ownership changed at ls-l too, but only a further umount and mount later. (though making this change was actually pointless after changing the umask value, but I forgot this at three in the morning!)
One side effect: I now have all green text at listings (ls) within the hd directory, and rather blue directory names, it's blue but 'green-blocked'. Anyone? Should I be concerned?
Still not 100% sure on the rationale as descibed by man page excerpt, so if anyone understands this well, i'd like to know myself.
You use the uid= and gid= mount options to change the ownership (when mounted). You don't use chmod or chown after mounting. You can also use the fmask= and dmask= mount options to change the permissions. These options are global. The ownership and permissions of all the files on the filesystem will be the same. There is a separate dmask option because you need the 'x' bit set for directories. It isn't advisable to have the 'x' bit sit for file.
Other Options:
If this is an external drive, consider running "udevinfo -q env -n /dev/hdb1" to get the UUID number of the filesystem. It is better to use
UUID=<uuid number> in the /etc/fstab entry. An external device could be assigned a different device node the next time. Also use the "noauto" option. This will prevent problems when booting if the device isn't connected. If you use the "user" or "users" option, in combination with the uid=<yourusername> option, you will be able to mount the device as a regular user. For pendrives, also use the "noatime" option to reduce the number of writes to the device.
Only a follow up to say the whole business of faking a mount is needless, I mention this only because I learnt this recently and don't want other new (to Linux) people reading this post thinking it is.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.