Cannot change folder and file permissions on NTFS drive

Hi. Newbie OpenSUSE 11.0.
I installed OpenSUSE on my exWindows XP computer which I had setup to share files on a LAN that were stored on a secondary slave drive. I switched to OpenSUSE and was able (with a lot of hair pulling and tons of google searches) to configure SAMBA to continue to share the files on the LAN. My other computer on the network uses WinXP. I can now see the folder SAMBA shares with no problem on my WinXP computer.
Issue now is that I cannot set sharing permissions on my secondary drive’s folders, so I cant share it. I need read/write access on these folders. When I try to share it, it tells me I am not the owner, so I tried to change the owner via

chown -R -v chepoxxx /windows/C

and it tells me that the owner has been changed on all recursive folders. But when I go into Nautilus and look under the Permission Tab on properties for a folder it still shows ‘root’ as owner and I cant share it!
What am I doing wrong here? I was able to share a folder and files on my ‘/home’ folder with no problems. Does it have something to do with the drive being NTFS?
I am just starting out with linux so please be gentle on your replies… Thanks

You cannot use chown on Windows because it does not use the Linux permissions system. Writing to NTFS partitions is also discouraged because, unlike FAT, there is a journal which you cannot update when Windows is not running.

To read and write to a NTFS partition, you need to change the contents of fstab.

But it would be probably be safer to organise your files so that you need to use NTFS write access as little as possible.

Also in general NTFS drives are mounted read-only by the system. Like john said, you can change this in fstab, but its highly discouraged.

I’m finding it hard to get my head around your setup/problem. I think you have this:

  • Machine running Suse
  • A second hdd is attached internally (i.e. not by external usb)
  • The second hdd has an NTFS partition mounted in directory “C”
  • You want to share the whole of the directory “C” via Samba
  • You are currently sharing “C” over the LAN but it is read-only and you want to be able to write too

Is that right? If not then please correct me.

That is exactly my setup. Just a few additional notes:

  • Computer no longer uses Windows (for good hopefuly)
  • Successfully shared /chepoxxx/home/Movies folder in network
  • Still not able to share folders in C (cannot access them through the other WinXP computer) on the network but read/write sharing on all folders in C is the goal.
  • Worried about < 4GB file restriction on FAT32 file systems

I consider myself medium to knowledgeable computer user and really want to get into the whole linux thing. Thanks for your help.

Let’s have a look at the ownerships and permissions: please open a console and enter these commands and post the dialogue back here:

ls -l /windows/C

that looks at the detail of the permissions/ownership of the files

cat /etc/fstab | grep ntfs

That looks at how you set up the mount

cat /etc/samba/smb.conf

That looks at how you share the directory “C”. It presupposes that you are not using Nautilus right-click sharing. If you are then let me know.

Sorry about the delayed reply. I went on a family trip for the weekend.
This is the output of the 3 terminal commands.


chepoxxx@chepolinux:/> ls -l /windows/C
total 72
drwxr-xr-x 1 root users 24576 2007-12-29 20:49 Chores Musick
drwxr-xr-x 1 root users  4096 2008-02-18 22:40 My Documents
drwxr-xr-x 1 root users 36864 2008-09-17 20:49 Progz
drwxr-xr-x 1 root users  4096 2008-02-18 21:43 RECYCLER
drwxr-xr-x 1 root users  4096 2006-12-29 21:00 System Volume Information
drwxr-xr-x 1 root users     0 2008-06-03 08:58 $VAULT$.AVG
chepoxxx@chepolinux:/> cat /etc/fstab | grep ntfs
/dev/disk/by-id/scsi-SATA_HDS728080PLAT20_PFD201S2C9BUKJ-part1 /windows/C           ntfs-3g    users,gid=users,fmask=133,dmask=002,locale=en_US.UTF-8 0 0
/dev/disk/by-id/scsi-SATA_WDC_WD800BB-22FWD-WMAJ93570724-part1 /windows/D           ntfs-3g    users,gid=users,fmask=133,dmask=002,locale=en_US.UTF-8 0 0
chepoxxx@chepolinux:/>  cat /etc/samba/smb.conf
# smb.conf is the main Samba configuration file. You find a full commented
# version at /usr/share/doc/packages/samba/examples/smb.conf.SUSE if the
# samba-doc package is installed.
# Date: 2008-06-06
[global]
	workgroup = auburn
	netbios name = chepolinux
	name resolver order = bcast host lmhosts wins
	printing = cups
	printcap name = cups
	printcap cache time = 750
	cups options = raw
	map to guest = Bad User
	include = /etc/samba/dhcp.conf
	logon path = \\%L\profiles\.msprofile
	logon home = \\%L\%U\.9xprofile
	logon drive = P:
	usershare allow guests = Yes
	usershare max shares = 100
	add machine script = /usr/sbin/useradd  -c Machine -d /var/lib/nobody -s /bin/false %m$
	domain logons = Yes
	domain master = Yes
	local master = Yes
	os level = 65
	preferred master = Yes
	security = user

[homes]
	comment = Home Directories
	valid users = %S, %D%w%S
	browseable = Yes
	read only = No
	inherit acls = Yes
[profiles]
	comment = Network Profiles Service
	path = %H
	read only = No
	store dos attributes = Yes
	create mask = 0600
	directory mask = 0700
[users]
	comment = All users
	path = /home
	read only = No
	inherit acls = Yes
	veto files = /aquota.user/groups/shares/
[groups]
	comment = All groups
	path = /home/groups
	read only = No
	inherit acls = Yes
[printers]
	comment = All Printers
	path = /var/tmp
	printable = Yes
	create mask = 0600
	browseable = No
[print$]
	comment = Printer Drivers
	path = /var/lib/samba/drivers
	write list = @ntadmin root
	force group = ntadmin
	create mask = 0664
	directory mask = 0775

[series]
	inherit acls = Yes
	path = /windows/D/Series
	read only = No

[netlogon]
	comment = Network Logon Service
	path = /var/lib/samba/netlogon
	write list = root


You will notice that there are actually 2 drives “C” and “D”. Both eventually want to have the same configuration so that WinXP laptop can have read/write access to both drives.

It seems to me that the drive /windows/C is not shared at all. That you can’t even see it from a windows machine. Is that right?

So to share it in a windows environment you make the Linux permissions to be rwxrwxrwx (to simulate windows) and then you share it to the world (making it accessible to “guests”)

This entry in fstab will mount the C partition in /windows/C so that it is rwrwrw and owned by a normal user:

/dev/sda1 /windows/C ntfs-3g uid=1000,gid=100,umask=0000 0 0

I’ve assumed that the C is sda1; alter if necessary. When the drive mounts it will be owned buy user 1000, probably that’s you. Anyway you check the owner’s name by executing this command again:

ls -l /windows/C

Suppose the owner is “billybob”.

You then create a share for “C” by editing these lines into smb.conf:

[Windows_C]
path = /windows/C
guest ok = yes
read only = no
force user = billybob

Try that. If problems. post the smb.conf and in addition post output of these too:

sudo /sbin/fdisk -l
ls -l /windows/C
cat /etc/fstab | grep ntfs

Of course, you treat “D” similarly.

Luck

How can I edit fstab from terminal with gedit??

Enter this incantation:

gnomesu gedit /etc/fstab

swerdna. you the man.
I was unable to see drive C through the network because I was trying to share through right clicking Nautilus. I changed smb.conf file as you showed me how and now I can see all ‘C’ folders & files through the network. Read & Write!
Still one question though…

This is the fstab content:

/dev/disk/by-id/scsi-SATA_SAMSUNG_SP0802NS00JJ40Y582673-part1 swap                 swap       defaults              0 0
/dev/disk/by-id/scsi-SATA_SAMSUNG_SP0802NS00JJ40Y582673-part2 /                    ext3       acl,user_xattr        1 1
/dev/disk/by-id/scsi-SATA_SAMSUNG_SP0802NS00JJ40Y582673-part3 /home                ext3       acl,user_xattr        1 2
/dev/disk/by-id/scsi-SATA_HDS728080PLAT20_PFD201S2C9BUKJ-part1 /windows/C           ntfs-3g    users,gid=users,fmask=133,dmask=002,locale=en_US.UTF-8 0 0
/dev/disk/by-id/scsi-SATA_WDC_WD800BB-22FWD-WMAJ93570724-part1 /windows/D           ntfs-3g    users,gid=users,fmask=133,dmask=002,locale=en_US.UTF-8 0 0
proc                 /proc                proc       defaults              0 0
sysfs                /sys                 sysfs      noauto                0 0
debugfs              /sys/kernel/debug    debugfs    noauto                0 0
usbfs                /proc/bus/usb        usbfs      noauto                0 0
devpts               /dev/pts             devpts     mode=0620,gid=5       0 0

Should I overwrite the whole line like so? (I don’t want to brake something… I have no clue of the meaning of some of the stuff I am overwriting…)

/dev/disk/by-id/scsi-SATA_SAMSUNG_SP0802NS00JJ40Y582673-part1 swap                 swap       defaults              0 0
/dev/disk/by-id/scsi-SATA_SAMSUNG_SP0802NS00JJ40Y582673-part2 /                    ext3       acl,user_xattr        1 1
/dev/disk/by-id/scsi-SATA_SAMSUNG_SP0802NS00JJ40Y582673-part3 /home                ext3       acl,user_xattr        1 2
/dev/sdb11 /windows/C ntfs-3g uid=1000,gid=100,umask=0000 0 0 
/dev/disk/by-id/scsi-SATA_WDC_WD800BB-22FWD-WMAJ93570724-part1 /windows/D           ntfs-3g    users,gid=users,fmask=133,dmask=002,locale=en_US.UTF-8 0 0
proc                 /proc                proc       defaults              0 0
sysfs                /sys                 sysfs      noauto                0 0
debugfs              /sys/kernel/debug    debugfs    noauto                0 0
usbfs                /proc/bus/usb        usbfs      noauto                0 0
devpts               /dev/pts             devpts     mode=0620,gid=5       0 0

If this is right, could you please shine a lil’ light on the subject of the actual code being overwritten? Thanks!


Now that I start to understand this a little bit better, I guess it would be worth to go through the trouble of actually backing up all the contents of these drives, getting rid of the NTFS partition, and reformat a new partition using ext3. What would be the advisable thing to do?

Sorry about the instigating questions… my brain is going through a lot with all this info. And again thanks a lot for the help!

I can’t see

sudo /sbin/fdisk -l

which I needed to see the partition numbering of “C”, so I’ll have to guess a bit: There is a problem I think. You have this partition numbered partition 1 as illustrated in red:

/dev/disk/by-id/scsi-SATA_HDS728080PLAT20_PFD201S2C9BUKJ-part1 /windows/C etc…

and you plan to replace it by a new terminology which looks just fine except you have changed the partition number as illustrated in red

/dev/sdb11 /windows/C ntfs-3g uid=1000,gid=100,umask=0000 0 0

The problem is that sdb11 is actually partition 9, and I don’t think that you have 9 partitions. So I think that if you carefully change the sdb11 to correct thing it will work. If it’s the first partition on the first drive then use sda1. If it’s the first partition on the second drive then use sdb1. If you’re confused then post the output from

sudo /sbin/fdisk -l

and I’ll tell you the correct thing for both windows “C” and “D”.

I have to take a break – so not to lose this typing I will post it and add more later regarding “shine a lil’ light on the subject of the actual code being overwritten” and formatting to ext3.

I guess it would be worth to go through the trouble of actually backing up all the contents of these drives, getting rid of the NTFS partition, and reformat a new partition using ext3. What would be the advisable thing to do?

I think you are at a decision point. It would be advisable IMO to replace the NTFS by ext3.

  1. If you have a LAN then it is fine to use ext3 to house data and to share it over a LAN to windows machines.

  2. But if the data are additionally in a dual boot sharing situation with access needed from windows and Linux on the same machine, you need to think twice about getting rid of NTFS.

So is your situation 1 only, or both 1 and 2?

You are right on the sdb11. It’s a typo, I replaced sda1 with sdb1 (which is drive ‘C’) but I guess I only partially overwrote it.

Computer with the drives no longer boots Windows. I think I can live without it. So I am in situation #1.

Well you have everything you need to make the NTFS type shares work (just get the sdb1 correct). You can copy the method for /windows/D too.

If you want to make a partition e.g. sdb1, into an ext3 partition and share it, here are the steps:

  • Take the data off
  • Suppose your new
    mount location will be e.g. directory sdb1 at /mnt/sdb1 then just use Yast → system → partitioner to make it happen.
  • Put an empty
    directory on the partition, e.g. “newshare” and make it owned by some non-root user, e.g. billybob
  • Put the data you wish to share into the directory “newshare”
  • the data should be owned by billybob. If they aren’t owned bu billybob than make it so with this command as a root user:
chown -R billybob:users /mnt/sdb1/newshare
  • Put this into smb.conf for newshare:
[some_good_name]
path = /mnt/sdb1/newshare
read only = no
force user = billybob
guest ok = yes

Got it. I will probably be doing that during the week. Mount both directories on a folder maybe in my ‘/home/chepoxxx’ directory. That way it’s all integrated into one neat folder structure. Linux rocks!
I am really getting the hang of this. But a n00b none the less. Still got a lot of reading and tweaking before I really get exactly what am doing. Any suggested links are welcomed.

Swerdna. Thanks a bunch. You got my setup up and working. Very nice experience with Linux and my first OpenSUSE forum thread.

Leaps and bounds!

I am newbie to linux, and just successfully configured my internet(it was fun). Now,I want to have access to windows folder from my linux terminal. This is what i tried and i dont know what is the next step.

mehul@linux-jvae:/etc> ls -l /windows
total 4
drwxr-xr-x 2 root root 4096 2010-02-08 03:56 C
mehul@linux-jvae:/etc> cat /etc/fstab | grep ntfs
/dev/disk/by-id/ata-FUJITSU_MHY2250BH_K432T8127GRM-part2 /windows/C ntfs-3g users,gid=users,fmask=133,dmask=022,locale=en_US.UTF-8 0 0
mehul@linux-jvae:/etc> cat /etc/samba/smb.conf

smb.conf is the main Samba configuration file. You find a full commented

version at /usr/share/doc/packages/samba/examples/smb.conf.SUSE if the

samba-doc package is installed.

Date: 2009-09-30

[global]
workgroup = WORKGROUP
printing = cups
printcap name = cups
printcap cache time = 750
cups options = raw
map to guest = Bad User
include = /etc/samba/dhcp.conf
logon path = \%L\profiles.msprofile
logon home = \%L%U.9xprofile
logon drive = P:
usershare allow guests = Yes
[homes]
comment = Home Directories
valid users = %S, %D%w%S
browseable = No
read only = No
inherit acls = Yes
[profiles]
comment = Network Profiles Service
path = %H
read only = No
store dos attributes = Yes
create mask = 0600
directory mask = 0700
[users]
comment = All users
path = /home
read only = No
inherit acls = Yes
veto files = /aquota.user/groups/shares/
[groups]
comment = All groups
path = /home/groups
read only = No
inherit acls = Yes
[printers]
comment = All Printers
path = /var/tmp
printable = Yes
create mask = 0600
browseable = No
[print$]
comment = Printer Drivers
path = /var/lib/samba/drivers
write list = @ntadmin root
force group = ntadmin
create mask = 0664
directory mask = 0775

Hi Mehul617, welcome to the forums.

I think that you have an installation of openSUSE and an NTFS partition on your hard disk that was mounted by the openSUSE installation program.

I think that you can see the files on the NTFS partition when you navigate to the directory /windows/C.

I think that your problem is: you can read the files in directory C but you can’t write to the directory or edit any files or folders there.

If you want to write to the directory C you need to change this line in fstab:

/dev/disk/by-id/ata-FUJITSU_MHY2250BH_K432T8127GRM-part2 /windows/C ntfs-3g users,gid=users,fmask=133,dmask=022,locale=en_US.UTF-8 0 0

to this form

/dev/disk/by-id/ata-FUJITSU_MHY2250BH_K432T8127GRM-part2 /windows/C ntfs-3g defaults,locale=en_US.UTF-8 0 0

The file “fstab” is a simple text file.
You edit it by running this command if you’re using KDE:

kdesu kwrite /etc/fstab

or this command if you’re using gnome:

gnomesu gedit /etc/fstab

When it’s open just change this fragment:

users,gid=users,fmask=133,dmask=022,locale=en_US.UTF-8

to this:

defaults,locale=en_US.UTF-8

Save and reboot.

Is that what you wanted?

FFI see this tutorial: HowTo Mount NTFS Filesystem Partition Read Write Access in openSUSE

Thank your for your help swerdna, it was very useful to me :slight_smile: