How do I share a folder on a NTFS partition over the network?
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
browseable = 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.