LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 02-04-2005, 08:00 PM   #1
dcdbutler
Member
 
Registered: Jan 2005
Location: Boston
Distribution: slackware
Posts: 502

Rep: Reputation: 30
unable to change file permissions!!


Hi all,
I'm using KDE 3.2 on Mandrake 10.1 official, it's been installed for less than a week. Things were working fine, until I did a yum update. Then things were still mostly fine except that I couldn't get access to my partitions and devices with the default mount options in the /fstab file (I was able to before). I was able to change that with some basic editing of the /fstab file. However, when I to do this command on an unmounted partition;
# chmod 777 /mnt/[partition]
and then I mount it and try to access the directory /mnt/[partition] through Konqueror, or Rox, it says that access is denied. When I look at the file permissions again, they've all been changed back to their previous settings, as though the system is overriding the root command. I've been messing about with UID and GID a bit as root in KDE (the red splash screen scares me), but they get changed back to default again as well.
I'm a bit stuck here, don't want to break anything and could do with some help.
Thanks for any advice!
Dave
 
Old 02-04-2005, 08:57 PM   #2
Ace07
Member
 
Registered: Feb 2005
Distribution: Fedora Core 3 (2.6.10_1.741)
Posts: 72

Rep: Reputation: 15
You can log into root via the console using the su command:

su <username>

Then enter the password and you can change the permissions of the /mnt folder by using the following commands:

chown -R <your username> /mnt
chmod -R 777 /mnt

(first one changes owner)
(second one changes permissions to readwrite)

That should make you able to access them with your regular user account. It is generally NOT recommended that you log into the root account from the login screen. Use "su root" via the command line whenever you need to change something like this.

If you need any more help, don't hesitate to ask...
 
Old 02-04-2005, 09:11 PM   #3
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
You need to perform the 'chmod' command on mounted partitions. If the partition is vfat or ntfs, then you need to use the 'uid=' and 'gid=' options in fstab or the mount command.
 
Old 02-04-2005, 09:25 PM   #4
dcdbutler
Member
 
Registered: Jan 2005
Location: Boston
Distribution: slackware
Posts: 502

Original Poster
Rep: Reputation: 30
Ah, ok, I didn't realise (or had forgotten) that the partitions had to be mounted for the chmod command to work.
I managed to change the permissions ok with chown and chmod this time.

So the new mount option line in /fstab should read something like
auto,user,gui=0,uid=0
for the vfat and ntfs partitions?
Also, inadvertantly, when I was messing around with Konqueror logged in as root, I somehow managed to make a couple of my partition folders into "Locked Folders" in the properties dialog box. What's the easiest way to set these back to regular folders again? It'll take me all night to figure it out unless you guys can point me in the right direction.
Many thanks for you help!
Cheers!
 
Old 02-04-2005, 09:30 PM   #5
Ace07
Member
 
Registered: Feb 2005
Distribution: Fedora Core 3 (2.6.10_1.741)
Posts: 72

Rep: Reputation: 15
Quote:
Originally posted by dcdbutler
Ah, ok, I didn't realise (or had forgotten) that the partitions had to be mounted for the chmod command to work.
I managed to change the permissions ok with chown and chmod this time.

So the new mount option line in /fstab should read something like
auto,user,gui=0,uid=0
for the vfat and ntfs partitions?
Also, inadvertantly, when I was messing around with Konqueror logged in as root, I somehow managed to make a couple of my partition folders into "Locked Folders" in the properties dialog box. What's the easiest way to set these back to regular folders again? It'll take me all night to figure it out unless you guys can point me in the right direction.
Many thanks for you help!
Cheers!
Locked folders as in owned by root? Or is it simply that your regular user can't read or write to them?

Most of those folders can be changed using (assuming you want readwrite for the particular folder):

chmod 777 <folder>

Use:
chmod -R 777 <folder>

to recursively change permissions. This changes the permissions of the folder and every folder/file underneath it.

And...make sure you are logged in as root of course.
 
Old 02-04-2005, 09:48 PM   #6
dcdbutler
Member
 
Registered: Jan 2005
Location: Boston
Distribution: slackware
Posts: 502

Original Poster
Rep: Reputation: 30
No, it's strange.
On the mounted partition I do;
# chown -R dave /mnt/[partitionname]
# chmod 777 /mnt/[partitionname]

Then I go into Konqueror to open the directory, but there's a padlock on the icon (like the /root directory has) and access is denied to the directory contents - This was something I must have done previously while logged into the console as root (which I'm not doing anymore).
It must be quite easy to remedy, I just don't know the answer.

Thanks again, when I get this sorted out, I'm gonna get drunk!
 
Old 02-04-2005, 10:11 PM   #7
dcdbutler
Member
 
Registered: Jan 2005
Location: Boston
Distribution: slackware
Posts: 502

Original Poster
Rep: Reputation: 30
Actually, I can't even access the folder /mnt through Konqueror now. It's got a padlock on iit as well. I can still access the directory and all contents through the terminal as root, but I'd love get rid of those padlocks.........
 
Old 02-04-2005, 11:34 PM   #8
dcdbutler
Member
 
Registered: Jan 2005
Location: Boston
Distribution: slackware
Posts: 502

Original Poster
Rep: Reputation: 30
OK, sorry to harp on about this - The padlocks have disappeared after a reboot (whew). I now get this.........

# ls -al /mnt
total 44
drwxr-x--- 9 dave dave 4096 Jan 31 20:53 ./
drwxr-xr-x 18 root root 4096 Feb 4 23:30 ../
drwxrwx--- 2 dave root 4096 Jan 30 17:21 cdrom/
drwxrwxrwx 0 root root 0 Feb 4 23:30 floppy/
drwxrwxrwx 2 dave root 4096 Jan 30 17:20 music/
drwxrwxrwx 2 dave root 4096 Jan 30 17:20 storage/
drwxrwx--- 2 dave root 4096 Jan 30 17:20 win98/
drwxrwx--- 2 dave root 4096 Jan 30 17:20 win_c/
drwxrwx--- 2 dave root 4096 Jan 30 17:20 win_c2/
# mount /mnt/music
# mount /mnt/storage
# ls -al /mnt
total 56
drwxr-x--- 9 dave dave 4096 Jan 31 20:53 ./
drwxr-xr-x 18 root root 4096 Feb 4 23:30 ../
drwxrwx--- 2 dave root 4096 Jan 30 17:21 cdrom/
drwxrwxrwx 0 root root 0 Feb 4 23:30 floppy/
drwxr--r-- 7 root root 16384 Dec 31 1969 music/
drwxr--r-- 5 root root 16384 Dec 31 1969 storage/
drwxrwx--- 2 dave root 4096 Jan 30 17:20 win98/
drwxrwx--- 2 dave root 4096 Jan 30 17:20 win_c/
drwxrwx--- 2 dave root 4096 Jan 30 17:20 win_c2/

My questions are:
1. Why have the file permissions and owner changed after mounting?
2. Why can't I open either /mnt/storage or /mnt/music with a graphical interface (or normal user at the terminal) after mounting?
3. Why has the date changed to Dec 31 1969 after mounting?

This is driving me nuts. Is it possible that another operating system has upset the balance here? I have edited files and folders in these partitions in another distro of Linux and Windows XP.

Thanks again!
Dave
I know I'll kick myself when I know the answer.
 
Old 02-05-2005, 02:41 PM   #9
Ace07
Member
 
Registered: Feb 2005
Distribution: Fedora Core 3 (2.6.10_1.741)
Posts: 72

Rep: Reputation: 15
To get certain users to be able to access those mount folders you need to edit your /etc/mtab or /etc/fstab file.

My fstab looks like this:
Code:
# This file is edited by fstab-sync - see 'man fstab-sync' for details
LABEL=/                 /                       ext3    defaults        1 1
none                    /dev/pts                devpts  gid=5,mode=620  0 0
none                    /dev/shm                tmpfs   defaults        0 0
LABEL=/home             /home                   ext3    defaults        1 2
none                    /proc                   proc    defaults        0 0
none                    /sys                    sysfs   defaults        0 0
/dev/hda6               swap                    swap    defaults        0 0
/dev/hda1               /mnt/c                  ntfs    ro,uid=500      0 0
/dev/hdb1               /mnt/d                  ntfs    ro,uid=500      0 0

/dev/hdc                /media/cdrecorder       auto    pamconsole,ro,exec,noauto,managed 0 0
/dev/fd0                /media/floppy           auto    pamconsole,exec,noauto,managed 0 0
The bolded parts are what I use so that users (the user id) can access the drives. However, I have heard that just putting "users" instead of that 'uid=' stuff actually works better. But since I have one user...there is no reason to mess with it I don't think.

(gid= group id that can access it)
 
Old 02-05-2005, 03:11 PM   #10
dcdbutler
Member
 
Registered: Jan 2005
Location: Boston
Distribution: slackware
Posts: 502

Original Poster
Rep: Reputation: 30
I managed to get it working.......for a while. I did this by
#chown [user] /mnt
#chown [user] /mnt[partitions]
and I changed the permissions accordingly.
then I went to open my partitions through the GUI all was fine.
I went out to buy some beer.
When I came back, I found I could still mount my partitions through the GUI, however, when I try to open the partition, I get an error message "The file or folder /mnt/[partition] does not exist". Nor am I able to open the folder /mnt through ROX or Konqueror, because permission is denied. Incredulous, I check out the permissions again for /mnt - They are
drwxr-x--- 9 root root 4096 Jan 31 20:53 mnt/
The owner has changed back to root. Why? I have no idea. The ownership of the folders in /mnt has remained as I had set it though - to the 'user' - me. It must be something simple I have missed or am doing wrong.
I don't have fstab-sync, but I edit my /fstab file through kwrite. Maybe there is something wrong with this. I will include it below for reference, in case anyone can tell me if there is a glaring ommission or some detail that absolutely should be changed.

/dev/hda6 / ext3 defaults 1 1
/dev/hdc /mnt/cdrom auto,iso9660 noauto,user,exec 0 0
/dev/fd0 /mnt/floppy auto sync,noauto,user 0 0
/dev/hda1 /mnt/win_c ignore 0 0
/dev/hda3 /mnt/win_c2 ignore 0 0
/dev/hda5 /mnt/music vfat users,noauto 0 0
/dev/hdb4 /mnt/storage vfat users,noauto 0 0
/dev/hda2 /mnt/win98 vfat users,noauto 0 0
none /proc proc defaults 0 0
/dev/hda7 none swap defaults 0 0
/dev/hdb5 none swap defaults 0 0

Thanks for all your help and time!
 
Old 02-05-2005, 07:16 PM   #11
dcdbutler
Member
 
Registered: Jan 2005
Location: Boston
Distribution: slackware
Posts: 502

Original Poster
Rep: Reputation: 30
ok, the problem seems to lie somewhere with the /mnt directory. I change ownership of this to user (myself). Everything's ok for a while. Then for some reason, ownership changes back to root later. then when I try to access the /mnt directories through the GUI (ROX), it tells me that access is denied. When I try to access the directory through one of the disk icons on my desktop (after mounting) I get the error message "The file or folder /mnt/storage does not exist."
The process can be reversed by 'reowning' the /mnt directory to 'user', but it's a temporary fix which eventually gets overwritten by root.

I'm beginning to wonder if this is a Mandrake specific problem - when I goggled this phrase, all I got were a few Mandrake users links which were not much help.

Anyone got any ideas? I'm tearing my hair out and my knuckles are bleeding from punching the wall in frustration!
 
Old 02-06-2005, 09:58 AM   #12
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
The permissions on the /mnt directory should be like this:
drwxr-xr-x 6 root root 4096 Jan 22 03:54 /mnt/
You could change the ownership of /mnt/c or /mnt/d (using mount options) but don't do that for /mnt.

In the fstab entry, you can use the user name in place of the uid or gid.

For example:
Quote:
/dev/hda1 /mnt/c ntfs ro,uid=ace007 0 0
Other options to use are 'fmask', 'dmask', 'users'. The 'users' option allows any user to unmount the drive. The 'fmask' option is like umask, but just for files.

Here is my NTFS paritions entry in my fstab file:
/dev/hda1 /mnt/win_c ntfs umask=0022,nls=iso8859-1,ro 0 0

Using 'fmask=0333,dmask=0222' may make more sense. For security reasons, you don't want to execute files on a storage paritition, or any partition with global write access.
Since the NTFS filesystem is read only anyway, I have the 'x' bit masked on files. But since the 'x' bit for directories allows entering them, the 'dmask' setting allows it.

I don't know about Red Hat and Fedora Core systems, but they may have a service such as 'msec' run by cron periodically to reset ownership and permissions of certain directories. If you have root's mail forwarded to yourself, you could monitor files on your system. For example, receiving warnings about world readable files.

Last edited by jschiwal; 02-06-2005 at 10:06 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Root cannot change file permissions. aje Slackware 3 08-12-2005 02:27 AM
Change default file permissions bmorel Linux - Newbie 4 05-08-2005 07:06 PM
chmod won't change the file permissions midtown266 Linux - Newbie 12 11-28-2004 07:46 PM
file permissions and file owner won't change Nadim Slackware 5 11-29-2003 06:03 PM
suddenly unable to change permissions (very strange) hobylinux Linux - Hardware 5 09-15-2003 06:30 PM


All times are GMT -5. The time now is 09:41 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration