Can't chmod or chgrp with sudo to a ntfs disk

Asked by RichG

I read the answer by Chris Coulson on 2008-07-12: to a similar question and didn't quite follow his example as an answer to the problem.
My situation, I took my Windows 2000 system with two NTFS formated hard drives. I loaded ubuntu on the primary (C) drive. It found and mounted the second disk by itself. Unfortunately all my directories and files are only readable. I can't edit anything. So, having come form a Sun Solaris background I try switching to root user, but that door is welded shut. Ok I look it up on the help lines and learn about sudo. Fine, I open a terminal and try out sudo. Seems to work till I get to the point I try chmod or chgrp on the files on the second disk. Using the -c option i get a report of the command and it shows it to be changing the files and directories from root to my user. Lies, all lies, nothing was actually changed.

What I want is for the files and directories to be owned by my user, not root. I don't care who mounts it as long as I can read and write to what is already there, and create new files and directories owned by me.

Can a user with administrator authority change the ownership of files on a mounted NTFS drive?
Never had this issue with Solaris, and I was always able to be the root user.


Rich G

Question information

English Edit question
Ubuntu ntfs-3g Edit question
No assignee Edit question
Solved by:
Andy Ruddock
Last query:
Last reply:
Revision history for this message
Abi ^-^ (abiyasa-eka) said :

Try this

use sudo chmod 777 /(your second partition location) -R

for ex:

sudo chmod 777 /media/DATA -R

don't forget to type -R at the end of command (it's case sensitive)

Revision history for this message
RichG (serviceman) said :

Well, everything was already 777, but I tried it anyway then tried the chgrp cmd.
sudo chgrp RichG /media/MyDisk -cR ; No Joy.
Sudo chgrp -cR richg /media/MyDisk also worked at least it showed every file and directory being changed, but nothing really took. No errors. looks like it is doing the changes (-c option) but it is not.
Still rwxrwxrwx root root for everything on the disk.


Revision history for this message
Abi ^-^ (abiyasa-eka) said :
Revision history for this message
Abi ^-^ (abiyasa-eka) said :

run this in terminal

sudo gedit /etc/fstab

please copy and paste the result here ...

Thanks ^-^

Revision history for this message
RichG (serviceman) said :

Interesting, to me anyway, the hard drives are not mounted?
there are two and yet the ls shows the second one and only after I select it from the Places menu.
I understand root owning the drive/partition but not every file and folder in it. The fact that the commands seem to work, but nothing is actually modified seems to be a problem.
Also I just created a folder in a folder on the BigDisk with the GUI interface and it shows up in the folder, but not on an LS of the folder. The new folder is owned by root in the root group, yet I am not root. If I try to share a file or folder with the GUI interface it says I do not have permission and need to have the administrator edit a smb file so I can share files and folders.
So much is familiar and yet different from my memories of Solaris. It has been 7 years :(

# /etc/fstab: static file system information.
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
# /dev/sda1
UUID=0cd62a40-d8f4-4fe7-9ca0-3438516f5bbb / ext3 relatime,errors=remount-ro 0 1
# /dev/sda5
UUID=4fd438d8-c567-4d4a-bdef-906bf5d93b1f none swap sw 0 0
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto,exec,utf8 0 0

Thanks for your help.

Revision history for this message
RichG (serviceman) said :

I looked at the link above about mounting windows partitions.
I will run through it as soon as I can.
I don't have time now, but it sure looks like it might do the trick


Revision history for this message
Andy Ruddock (andy-ruddock) said :

While your ntfs drive is automounted type "mount" to get the device node for the ntfs device.
So for example on my machine I see :
/dev/sdb1 on /media/winxp

In /etc/fstab use :

/dev/sdb1 /media/winxp ntfs rw,uid=richg,gid=richg

Although you can read and write to data in an ntfs partition you can't change much of the metdata (data about data) because it is tightly integrated into the operating system it was created under.
If you could change ownership of those files to your user what would happen next time you booted windows, how would it be able to understand those changes?

Revision history for this message
Abi ^-^ (abiyasa-eka) said :

I thing you should try ntfs-config that will enable you to write ntfs partition

sudo apt-get install ntfs-config

Revision history for this message
RichG (serviceman) said :

To answer a misconception here, which I must not have made clear up front, sorry.
This computer USED TO BE A WINDOWS 2000 MACHINE.
Windows 2000 got corrupted and I decided to replace it with Ubuntu UNIX. The original format of the C drive was fat32 and Ubuntu could not see it at all. I formated the drive during the Ubuntu install to NTFS. The D drive, the one I am trying to gain read write and ownership to was already NTFS and recognized by Ubuntu.
Now I have Ubuntu only on my C drive and it is 100% configured by Ubuntu.
The D drive has ALL MY OLD DATA FILES, ALL MY RECORDS, ALL MY PURCHASE AND SALES RECORDS. All I want is to be able to open and use those files with the programs in OpenOffice 3.0.
I can open and read them but not write to them, I can't delete them, I can make new ones, but that doesn't help unless I want to copy every old file to a new one. I am 62 years old, I don't have enough years to do all that.

If I had the real root authority/password I should be able to log in as root and change the files and folder to be owned by any user I chose.
Ubuntu will not allow that, I guess, because someone has decided to protect something by keeping the root password a big secret. Part of that protection is written into the sudo command it seems. So sudo does not give total root authority.

Now I have another suggestion to get back to and see if it will get me around the real problem.

BTW I do not wish to take this machine back to a windows box if I can avoid it.

Thanks for everyones help, this truely is a fantastic group of very smart and helpful people and I really really appreciate what you all do.

Revision history for this message
Abi ^-^ (abiyasa-eka) said :

if you want to explorer your file as root, you can open nautilus as root

press alt+f2, a small box will appear, type

gksu nautilus (it will be ask your password)

Then, now you can explore your file as root ...

Revision history for this message
Best Andy Ruddock (andy-ruddock) said :

Sudo does give full root authority - type "sudo -s" and it's just the same as logging in as root.

If you *really* need a root password type "sudo passwd", type your password, then the password you want for the root user (twice). Now you'll be able to login as root - but don't, because you can really screw things up royally that way.

You won't get the control over file properties the way you want unless you use native linux filesystems (ext3 being the obvious example), because software for the other filesystems is written with compatibility in mind.
For example, fat32 doesn't support symbolic links, ntfs won't let you arbitrarily assign user/group ids to files because that would screw up the access from the operating system that filesystem originated under.

I'm assuming when you talk of C and D drives that you have two physical hard disks. The easiest solution would be to re-install Ubuntu on the primary drive formatting it as ext3 when you do so.
You will still have access to those files on your secondary drive - you should then beg, steal or borrow (well, not steal actually, but you get the gist) an external usb drive.
Copy everything from the secondary drive to this external drive, reformat the secondary to ext3, then copy everything back.

Revision history for this message
RichG (serviceman) said :

This seems to answer the question.
I was able to log in as root changed the password and still couldn't change anything in the file system.
Never heard of ext3 format? When did that appear, don't have to answer I'll check it out.
I guess linux uses the ext3 format so I'll back up everything and reinstall the OS and copy everything back from my usb drive.
Seems like an unfriendly way to do things, especially if one wanted to have a dual boot system and have full access and control over his system. Not being able to edit files because your the wrong administrator/superuser/root/user or whatever sucks.

But in all my years at Sun we never could, or were even allowed to use windows and Solaris at the same time and even had conversion programs so we could work on a file with a windows app then a UNIX app. Converting every time I went from home to the office was a pain but it was better than the alternatives.

Ill try the reformatting and reinstalling of everything and see how it goes.
Thanks to all that replied you were a big help

Revision history for this message
RichG (serviceman) said :

Thanks Andy Ruddock, that solved my question.