LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 05-26-2008, 12:42 PM   #1
gregorian
Member
 
Registered: Apr 2006
Posts: 509

Rep: Reputation: 34
Root can't chgrp or set permissions on directory?


I wanted to have write permissions for the the drives that listed as C: D: E: F: under windows. I mounted these on C D E F directories respectively under /mnt.

I created a group called "mygroup", added my account to it; and I tried to change the group it belonged to "mygroup" and set read, write and execute permissions for that group. It worked for folder C, but not for D E and F. Also what's up with the date of creation of D E and F?! I was not even born then... and there are some differences in the other dates too.. some 2006, some 2002. I installed Slackware a few days back..

Code:
root@foo:/mnt# chgrp mygroup C D E F
chgrp: changing group of `D': Operation not permitted
chgrp: changing group of `E': Operation not permitted
chgrp: changing group of `F': Operation not permitted
root@foo:/mnt# chmod 775 C D E F
root@foo:/mnt# ls -l
total 84
drwxrwxr-x 1 root mygroup  4096 2008-05-26 15:18 C
drwxr-xr-x 9 root root    16384 1970-01-01 05:30 D
drwxr-xr-x 9 root root    16384 1970-01-01 05:30 E
drwxr-xr-x 4 root root     8192 1970-01-01 05:30 F
-rw-r--r-- 1 root root      376 2006-09-26 08:39 README
drwxr-xr-x 2 root root     4096 2006-09-26 06:32 cdrecorder
drwxr-xr-x 2 root root     4096 2002-03-16 13:04 cdrom
drwxr-xr-x 2 root root     4096 2006-09-26 06:32 dvd
drwxr-xr-x 2 root root     4096 2008-05-24 14:22 flash
drwxr-xr-x 2 root root     4096 2002-03-16 13:04 floppy
drwxr-xr-x 2 root root     4096 2002-03-16 13:04 hd
drwxr-xr-x 2 root root     4096 2006-09-26 06:32 memory
drwxr-xr-x 2 root root     4096 2006-09-26 06:33 tmp
drwxr-xr-x 2 root root     4096 2006-09-26 06:32 zip
root@foo:/mnt#

Last edited by gregorian; 05-26-2008 at 12:46 PM.
 
Old 05-26-2008, 05:12 PM   #2
seraphim172
Member
 
Registered: May 2008
Posts: 101

Rep: Reputation: 15
removable devices

Drive C is certainly a hard disk, so changing permissions and ownership makes sense and is possible.

Drive D is most likely a CD/DVD drive - an empty CD/DVD drive doesn't have ownership, and with each inserted media contents and ownership will be different.

I assume that E and F are also some external removable devices. You can not change ownership of device, only of it's current contents, if any.

Linux Archive

Last edited by seraphim172; 06-25-2008 at 04:29 AM.
 
Old 05-26-2008, 06:06 PM   #3
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
Since you access them under windows I'm assuming there are fat32 or ntfs file systems on those partitions. Non-linux file systems don't support the same permissions as linux file systems. Have a look at man mount and search for vfat and ntfs. You can use options like umask, uid and gid to specifiy permissions and ownership.
 
Old 05-26-2008, 08:40 PM   #4
eggixyz
Member
 
Registered: Apr 2008
Posts: 310

Rep: Reputation: 30
Hey There,

This might work. Umount D E and F and chmod the directories 777, then remount them and see if the chgrp will work then. I've seen that happen before.

Best wishes,

Mike
 
Old 05-26-2008, 10:50 PM   #5
gregorian
Member
 
Registered: Apr 2006
Posts: 509

Original Poster
Rep: Reputation: 34
seraphim172 - They're ntfs and vfat drives.
eggixyz - I'm still getting the same errors.

gilead, Your method works. I set gid to be that of my group and the umask to be 002. Could you tell me why my date of creation is in 1970? If I'm not mistaken isn't that the beginning of the epoch which Slackware uses?

Thank you all for your help!

Last edited by gregorian; 05-26-2008 at 10:52 PM.
 
Old 05-26-2008, 10:58 PM   #6
eggixyz
Member
 
Registered: Apr 2008
Posts: 310

Rep: Reputation: 30
Cool,

Glad you got it to work The epoch is January 1st 1970

Best wishes,

Mike
 
Old 05-26-2008, 11:00 PM   #7
gregorian
Member
 
Registered: Apr 2006
Posts: 509

Original Poster
Rep: Reputation: 34
Why do D E and F have epoch times?! Their contents show correct times of creation!
 
Old 05-26-2008, 11:15 PM   #8
eggixyz
Member
 
Registered: Apr 2008
Posts: 310

Rep: Reputation: 30
Sorry, just have to ask,

Are D E and F mounted with the filesystem type specified in the mount command? I've seen this before if you choose default and/or don't specify vfat or ntfs. I've also seen this happen on mounted filesystems when a Linux distro doesn't fully support ntfs.

Best wishes,

Mike
 
Old 05-27-2008, 12:32 AM   #9
gregorian
Member
 
Registered: Apr 2006
Posts: 509

Original Poster
Rep: Reputation: 34
When I first installed Slackware, I specified the mount types for D, E and F as auto. But I didn't like the boot messages as it mentioned something along the lines of filesystem not mentioned, trying vfat.. Later on I replaced auto with vfat. Is this a bug?
 
Old 05-27-2008, 12:57 AM   #10
eggixyz
Member
 
Registered: Apr 2008
Posts: 310

Rep: Reputation: 30
Hey,

I wondering that myself. Check this link from another thread. It basically says that since vfat doesn't have a c_time stamp, so the date on the filesystem get's set to 1/1/1970, which, depending on what time zone you're in can sometimes also be 12/31/69, which (in most cases) means that Linux can't figure out the time (that makes sense though if vfat doesn't carry a c_time (inode creation time) for the OS to read.

http://unixresources.org/linux/lf/47...67/126787.html

Hope that helps

, Mike
 
Old 05-27-2008, 03:17 AM   #11
gregorian
Member
 
Registered: Apr 2006
Posts: 509

Original Poster
Rep: Reputation: 34
It's related to the time zone alright. I live in India which is 5 and a half hours ahead of GMT and that's the file creation time. I know that c_time is a structure in C but that's it. Sorry if I sound noobish.. but can't Linux read timestamps other than c_time? The contents inside the fat partitions have correct timestamps.. why does the problem exist only with the mounted directory? With reference to your previous post, does putting auto instead of 'vfat' make a difference?
 
Old 05-27-2008, 05:17 AM   #12
Omer Fadul
LQ Newbie
 
Registered: Feb 2005
Location: Khartoum, Sudan
Distribution: Redhat+Suse
Posts: 12

Rep: Reputation: 0
i think the problem is more simpler than that, it is related to the account u use to access the system.
in other words, you logged to the system like a normal user and then you do su without - option on that way you will use the current user profile rather than full root user profile.
 
Old 05-27-2008, 08:10 AM   #13
gregorian
Member
 
Registered: Apr 2006
Posts: 509

Original Poster
Rep: Reputation: 34
I'm positive you get complete root privileges when you use su. I logged in as root too. I faced the same problem, but now that's fixed. Now I'm just interested in the date of creation issue I'm facing.
 
Old 05-27-2008, 07:18 PM   #14
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Actually,

su

gets you in as root, BUT you retain the original user's env.

su -

gets you in as root WITH root's env settings.

HTH

Incidentally,

"Three fields in the inode structure contain the last access, change, and modification times: atime, ctime, and mtime. The atime field is updated each time the pointer to the file's data blocks is followed and the file's data is read. The mtime field is updated each time the file's data changes. The ctime field is updated each time the file's inode changes. The ctime is not creation time; there is no way under standard Unix to find a file's creation time."

Perl Cookbook, Chap 9, Directories.
 
Old 05-27-2008, 09:35 PM   #15
eggixyz
Member
 
Registered: Apr 2008
Posts: 310

Rep: Reputation: 30
Yes,

My mistake - ctime does refer to the inode "change" time and not inode "creation" time. The point I was trying to make originally was that vfat doesn't have that, which is what can cause the incorrect timestamp on mounted vfat resources.

Apologies for any confusion I created. The other discussion I linked to addresses why the vfat problem exists.

Also, I think there's a bit of confusion between privilege and environment. Su'ing to root, with or without sourcing the profile, does give the user root privilege, but they keep the original user's environment settings, for the most part.

Is the issue still just that the timestamps are not correct? As far as I know and have been able to research, it may be impossible to mount a vfat partition and fake the date easily, but, as long as the mount works I would say "problem solved"

I could be missing something. I've obviously missed a few back-and-forths here.

In any event, best wishes,

Mike
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
permissions using cmod/chgrp not changing heyme Linux - Newbie 5 11-18-2007 05:46 PM
how to set Samba directory / share permissions rwtreke Linux - General 2 02-16-2006 03:24 PM
How to permanently set permissions on all files created in a directory? BrianK Linux - General 8 06-24-2004 04:06 PM
directory permissions incorrectly set DutchBoy Linux - Security 3 01-05-2004 09:40 AM
How to set correct file/directory permissions pat.delaney Linux - Networking 5 12-02-2003 09:39 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:20 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration