LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 08-19-2008, 12:50 AM   #1
newbiesforever
Senior Member
 
Registered: Apr 2006
Posts: 1,995

Rep: Reputation: 65
why can't I chown a hard drive?


Linux (I'm using MEPIS 7) wouldn't let me rename a folder on one of my HDs. I looked at the permissions and saw that the owner was root. (I think an error changed it, because I copied something to this drive recently, and didn't have a permissions problem.) So I logged into the root account and, both in the GUI and then in a console, tried to chown not just the folder but the entire drive to my account. (I'm the only user.) When I tried this in the GUI, the drive just ignored my changes (I know that because after clicking OK, I checked the permissions again, and root was the owner again.) So I opened a console and went through this:
root@mepis1:~# chown users '/mnt/sdb1'
chown: `users': invalid user
root@mepis1:~# chown josh '/mnt/sdb1'
chown: changing ownership of `/mnt/sdb1': Operation not permitted
root@mepis1:~#
Not permitted? Why not?

In case it was because one can't chown an entire drive at once, I then tried to chown the three folders one at a time (although that's not good enough, because I don't want any future folders I make to be owned by root). That produced the same result. So why can't I change the permissions or ownership from the root account?
 
Old 08-19-2008, 01:09 AM   #2
klearview
Member
 
Registered: Aug 2006
Location: London
Distribution: Debian, Kubuntu
Posts: 572

Rep: Reputation: 75
Could you please provide 'ls -al' output for the directory you're trying to chown.
 
Old 08-19-2008, 01:11 AM   #3
newbiesforever
Senior Member
 
Registered: Apr 2006
Posts: 1,995

Original Poster
Rep: Reputation: 65
Now I have more information. I went back to my account, and unmounted and then mounted it. Now the owner is me. Why would that happen?

(Something possibly related to this is that after I bring it out of hibernation (I use Suspend to Disk often), the drives are unreadable and unwriteable. I can solve the problem by unmounting and mounting them.
 
Old 08-19-2008, 01:12 AM   #4
newbiesforever
Senior Member
 
Registered: Apr 2006
Posts: 1,995

Original Poster
Rep: Reputation: 65
You posted that while I was adding another post. But I performed that command. It says:
root@mepis1:~# ls -al '/mnt/sdb1'
total 68
drwxr-xr-x 5 josh users 16384 1969-12-31 17:00 .
drwxr-xr-x 8 root root 4096 2008-08-15 20:04 ..
drwxr-xr-x 16 josh users 16384 2008-08-15 20:34 data
drwxr-xr-x 2 josh users 16384 2000-02-10 17:49 My Documents
drwxr-xr-x 6 josh users 16384 2008-08-14 20:40 Program Files
root@mepis1:~#
However, that is after I unmounted and then mounted the drive, because I didn't wait for a response to my first post before posting more information (sorry!) I can't ls -al the folder when it claims the owner is root. (I should get a chance to, because this will probably happen again. This type of screwup has been happening a lot for me in MEPIS 7. I'm annoyed enough by it to change distros.)

Last edited by newbiesforever; 08-19-2008 at 01:20 AM.
 
Old 08-19-2008, 01:39 AM   #5
klearview
Member
 
Registered: Aug 2006
Location: London
Distribution: Debian, Kubuntu
Posts: 572

Rep: Reputation: 75
My guess would be that the disk in question is formatted as Windows FAT32 or NTFS.

If that's the case (and seeing "My Documents" and "Program Files" there leads me to believe it is) then all you need to do is to change system' default behaviour.

FAT32 partitions are mounted by default under ownership root:root with 770 permission. Change /etc/fstab entry for the disk in question by adding (or changing) 'umask=0' then remount.

If anything still doesn't work just post here and I'm sure we'll work it out.

Last edited by klearview; 08-19-2008 at 05:41 AM. Reason: Clarification
 
Old 08-19-2008, 01:59 PM   #6
newbiesforever
Senior Member
 
Registered: Apr 2006
Posts: 1,995

Original Poster
Rep: Reputation: 65
Thank you, Klearview. It's formatted to FAT32, yes, because I was sharing it between Windows and Linux until my Windows installation permanently stopped working recently. So I'll try that.
 
Old 08-19-2008, 02:21 PM   #7
newbiesforever
Senior Member
 
Registered: Apr 2006
Posts: 1,995

Original Poster
Rep: Reputation: 65
Is this the proper format? Sda4 is the drive.

_________________________________
# Pluggable devices are handled by uDev, they are not in fstab
/dev/sda1 /mnt/sda1 vfat,ext3,ext2,reiserfs auto,users,exec,rw 0 0
/dev/sda2 / ext3 defaults,noatime 1 1
/dev/sda4 /mnt/sda4 auto auto,users,exec,rw,umask=0 0 0
/dev/sda5 /mnt/sda5 auto auto,users,exec,rw 0 0
/dev/sda6 swap swap sw,pri=1 0 0
/dev/sdb1 /mnt/sdb1 vfat,ext3,ext2,reiserfs auto,users,exec 0 0
none /proc proc defaults 0 0
none /proc/bus/usb usbfs devmode=0666 0 0
none /dev/pts devpts mode=0622 0 0
none /sys sysfs defaults 0 0
# Dynamic entries below
/dev/sdc1 /mnt/sdc1 vfat,ext3,ext2,reiserfs noauto,users,exec 0 0
/dev/cdrom /media/cdrom udf,iso9660 noauto,users,exec,ro 0 0
/dev/scd0 /media/cdrom udf,iso9660 noauto,users,exec,ro 0 0
 
Old 08-19-2008, 02:36 PM   #8
klearview
Member
 
Registered: Aug 2006
Location: London
Distribution: Debian, Kubuntu
Posts: 572

Rep: Reputation: 75
seems right - don't forget to remount.
 
Old 09-10-2008, 05:44 PM   #9
newbiesforever
Senior Member
 
Registered: Apr 2006
Posts: 1,995

Original Poster
Rep: Reputation: 65
What do "noatime," "umask" and "pri" mean?
 
Old 09-10-2008, 07:59 PM   #10
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,063

Rep: Reputation: 381Reputation: 381Reputation: 381Reputation: 381
Quote:
Originally Posted by newbiesforever View Post
What do "noatime," "umask" and "pri" mean?
For that, use

Code:
man mount
Your original problem was that fat32 simply doesn't accept the linux permissions/ownership scheme, in other words: it's *invulnerable* to chmod/chown. That's where umask gets into scene: it sets the default permissions for a fat32 fs via the correspondent driver, and not in the linux userland (where fat32 simply doesn't understand them).
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Moving files from a Linux hard drive to a Windows Vista Premium hard drive WolfMan51 Linux - Hardware 5 07-12-2011 10:19 AM
Clone a dual booting IDE hard drive to a SATA hard drive namida12 Linux - Distributions 1 07-14-2008 11:01 AM
Ubuntu: Installed to external hard drive; boot to primary hard drive gives error 22 dcorb62 Linux - General 7 09-05-2007 12:28 AM
chown-ing all files on a drive owned by one user. nkoplm Linux - General 1 10-26-2006 07:20 AM
Installing grub to external USB hard drive for later use as internal hard drive dhave Linux From Scratch 2 12-10-2005 09:48 AM


All times are GMT -5. The time now is 12:31 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration