Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm on Ubuntu 11.10, and I want to share a folder on an automounted NTFS partition (/dev/sda4) over the network. The purpose of this network is to share files between computers, it contains mostly Windows computers. I use this /dev/sda4 partition both from Windows 7 and Ubuntu. Using Nautilus, I right-click the directory, then I click 'Sharing Options', then I mark the three checkboxes. When I try to apply the settings though, it says 'Couldn't change the rights of the folder "foldername"'.

I've put the output of sudo blkid and cat /etc/fstab below.

sudo blkid

/dev/sda2: LABEL="Windows" UUID="481319C261268D8D" TYPE="ntfs" 
/dev/sda3: UUID="23dac5e8-aae7-43ac-964c-c8a5a033b0d7" TYPE="ext4" 
/dev/sda4: LABEL="Data" UUID="00F1B269675B86AE" TYPE="ntfs" 
/dev/sda5: UUID="6de8b757-f17e-4e36-935c-a3fd6012c628" TYPE="ext4" 
/dev/sda6: UUID="d504bae2-fad6-4f6a-b489-7719ad0fe3b3" TYPE="swap" 

cat /etc/fstab

# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    nodev,noexec,nosuid 0       0
# / was on /dev/sda3 during installation
UUID=23dac5e8-aae7-43ac-964c-c8a5a033b0d7 /               ext4    errors=remount-ro 0       1
# swap was on /dev/sda6 during installation
UUID=d504bae2-fad6-4f6a-b489-7719ad0fe3b3 none            swap    sw              0       0
/dev/sda4 /media/Data ntfs defaults,umask=007,gid=46 0 0 

How can I share this folder?

share|improve this question
    
When you say "over the network" what do you mean, what kind of computers are going to be there? Windows? Then you need samba, only Linux? Then NFS is recommended... Give us more info. –  Bruno Pereira Dec 7 '11 at 19:42
1  
I think permissions in fstab needs to be changed. Try the same procedure with removed gid (don't forget to remount), and tell us if it helped. –  Andrejs Cainikovs Dec 7 '11 at 20:22
    
I have updated the question. Removing gid from /etc/fstab makes the last line look like this: /dev/sda4 /media/Data ntfs defaults,umask=007 0 0. /dev/sda4 isn't mounted on startup, sudo mount /dev/sda4 /media/Data gives me the following output: Mount is denied because the NTFS volume is already exclusively opened. The volume may be already mounted, or another software may use it which could be identified for example by the help of the 'fuser' command. –  Exeleration-G Dec 7 '11 at 22:35

3 Answers 3

up vote 4 down vote accepted

After a bit of searching, I found the solution myself:

First, I had to give myself the ownership over /dev/sda4, and I had to give group and others read and execute permission. I did that by changing the partition entry in /etc/fstab.

To do that, I had to know my uid and gid. So the first thing I did was writing the following command in a Terminal:

id $USER

This will give an output like this:

UID=1000(myname) GID=1000(myname) groups=1000(myname),4(adm),24(cdrom), ...

So now I knew that both my uid and my gid were 1000.

Do you already know the name of the NTFS partition? If not, type this command in a Terminal:

sudo blkid

and write down the NTFS partition on a piece of paper.

Now, to change the permissions, I edited /etc/fstab with the nano text editor. So, the next command you have to type in a terminal is:

sudo nano /etc/fstab

Go all the way down and type this line:

/dev/sda4 /media/Data ntfs defaults,umask=0022,uid=YourUIDHere,gid=YourGIDHere 0 0

(You should replace /dev/sda4 by the NTFS partition that you wrote down earlier).

Explanation: umask=0022 sets the directory's (d) permissions permissions to drwxr-xr-x, to make sure that the user (me) can read, write and execute (rwx) while the group and others can only read and execute (r-x) the directory, which is what I wanted.

After that, I could mark the three checkboxes without any errors, and the folder would be shared over the network. Because I was not sure whether the sharing settings would be kept after a restart, I unchecked the checkboxes and added some lines in /etc/samba/smb.conf instead. I did that this way:

In a terminal, I typed sudo nano /etc/samba/smb.conf

I scrolled down to the last line, and pasted the following there:

[MyShare]
    comment = My Share
    path = /media/Data/FolderToBeShared
    browsable = yes
    guest ok = yes
    read only = yes
    create mask = 0755

I saved the file, and then rebooted. The folder was accessible from the network now.

share|improve this answer
1  
Brilliant. As a complete linux/ubuntu novice I was banging my head against the wall for 2 days because If this had been a windows machine I would have had it done in 10 minutes. –  Patrick Dec 16 '13 at 12:53
    
Can you edit this answer with all the commands you had to write, please? I am not sure I understand what you mean with "give myself ownership over /dev/sda4". –  Dbugger Aug 29 at 16:39
    
Sure, but afterwards, please give me an update on whether the instructions worked for you. I'm not using a NTFS partition anymore so I can't check by myself. –  Exeleration-G Aug 29 at 22:04

The most simple solution I can think of us is to use a symlink to the NTFS partition.

How I would do this is:

  • Create a folder on your Ubuntu partition that you can share.
  • Link the folder on the windows partition to be within this folder:
    ln -s /path/to/folder/on/ntfs /path/to/new/location/linkname
  • Set the parent folder you created to be shared over the network, choosing any extra options as you desire (for example, allowing guest etc).
  • Click "apply permissions to enclosed files" in the permissions tab. Not every single permission will be applied, of course, but read access should be enough.

I have not tested this myself, but if I understand sharing correctly, it should be able to work.

share|improve this answer
    
That would be ln -s, right? Trying it out right now. –  Exeleration-G Dec 8 '11 at 15:17
    
@Exeleration-G: yep sorry for the typo –  RolandiXor Dec 8 '11 at 15:21
    
This didn't work out for me, thanks though. –  Exeleration-G Dec 10 '11 at 11:57

just mount the ntfs dir as:

-o uid=current_user,gid=current_usergroup

get the current user and current user group as pointed by Exeleration-G:

id MyUserName
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.