Page 1 of 1

Cannot share NTFS partition on samba

Posted: Sun Jul 26, 2015 2:22 pm
by Draknof
Hi all,

I have followed many tutorials and configuration of /etc/samba/smb.conf but nothing works, I cannot share any drive that is formatted in NTFS.
I don't know why it remains so complicated to do such basic things in Linux in 2015, especially when anyone can do that in a couple of seconds since Windows xp :evil:

I can share folders on ext4 partitions, I can access folders from other ext4 partitions or from other Windows computers, but the Linux NTFS permission setting is just a nightmare.
Can someone explain in a easy way:
1) is it possible to share NTFS folder on samba with other Linux/Windows computers?
2) how?

Thanks!

Re: Cannot share NTFS partition on samba

Posted: Sun Jul 26, 2015 2:30 pm
by altair4
Need to see how you are set up. Please post the output of the following commands:

Code: Select all

testparm -s

Code: Select all

net usershare info --long

Re: Cannot share NTFS partition on samba

Posted: Sun Jul 26, 2015 3:59 pm
by Draknof
There may be stupid settings because I have desperately tried so many things:

Code: Select all

m-okanochiwa@Mint ~ $ testparm -s
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
WARNING: Ignoring invalid value 'share' for parameter 'security'
Processing section "[printers]"
Processing section "[print$]"
Processing section "[Aelis]"
Processing section "[Music]"
Loaded services file OK.
Server role: ROLE_STANDALONE
[global]
	server string = %h server (Samba, Linux Mint)
	server role = standalone server
	map to guest = Bad User
	obey pam restrictions = Yes
	pam password change = Yes
	passwd program = /usr/bin/passwd %u
	passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
	unix password sync = Yes
	syslog = 0
	log file = /var/log/samba/log.%m
	max log size = 1000
	dns proxy = No
	usershare allow guests = Yes
	usershare owner only = No
	panic action = /usr/share/samba/panic-action %d
	idmap config * : backend = tdb
	guest ok = Yes

[printers]
	comment = All Printers
	path = /var/spool/samba
	create mask = 0700
	printable = Yes
	print ok = Yes
	browseable = No

[print$]
	comment = Printer Drivers
	path = /var/lib/samba/printers

[Aelis]
	comment = Aelis videos
	path = /media/m-okanochiwa/Aelis

[Music]
	comment = Music
	path = /media/m-okanochiwa/Solvatus/Music
	read only = No
	create mask = 0644

Code: Select all

net usershare info --long
WARNING: Ignoring invalid value 'share' for parameter 'security'
[DiabloII]
path=/media/m-okanochiwa/Solvatus/Linux Games/DiabloII
comment=
usershare_acl=Everyone:F,
guest_ok=y

info_fn: file /var/lib/samba/usershares/test francois is not a well formed usershare file.
info_fn: Error was Path is not a directory.
[Test Mint]
path=/home/m-okanochiwa/Test Mint
comment=
usershare_acl=Everyone:F,
guest_ok=y

[Video]
path=/media/m-okanochiwa/Aelis/Video
comment=
usershare_acl=Everyone:R,Unix User\m-okanochiwa:F,
guest_ok=y

[Music]
path=/media/m-okanochiwa/Solvatus/Music
comment=
usershare_acl=Everyone:R,Unix User\m-okanochiwa:F,
guest_ok=y

Re: Cannot share NTFS partition on samba

Posted: Sun Jul 26, 2015 4:12 pm
by altair4
The problem isn't that it's on an NTFS partition it's where that NTFS partition is mounted.

For example:
/media/m-okanochiwa/Aelis/Video
The way Linux works now /media/$USER ( in this case /media/m-okanochiwa ) is under the controll of an Access Contol List that prevents everyone except $USER ( m-okanochiwa ) from accessing anything under it.

One way to solve this problem since all your shares are guest accessible anyway is to make everyone look like m-okanochiwa:

Edit /etc/samba/smb.conf and in the [global] section and add the following line - I would put it right uner the "workgroup = workgroup " line so you can see it easily:

Code: Select all

force user = m-okanochiwa
Save the file then restart smbd:

Code: Select all

sudo service smbd restart
The samba client will be converted to m-okanochiwa when he accesses the share but still be under the control of the samba share definition. So If you create a guest accessible share as read only then the client user will only have read access even though he appears to be you. I hope that made sense

Re: Cannot share NTFS partition on samba

Posted: Sun Jul 26, 2015 4:28 pm
by Draknof
It works, awesome !
Thanks a lot :D

Now I understand this is the quick and dirty way to do, and anyone connecting to my network would access all the shared drives.
What is the clean way to restrict access to some sensitive folders only to authorised devices (Android, Linux and Windows...)?

Re: Cannot share NTFS partition on samba

Posted: Sun Jul 26, 2015 4:42 pm
by altair4
"force user" doesn't necessarily preclude a more restrictive approach.

For example instead of this:
[Aelis]
comment = Aelis videos
path = /media/m-okanochiwa/Aelis
You could do this:
[Aelis]
comment = Aelis videos
path = /media/m-okanochiwa/Aelis
valid users = altair, m-okanochiwa, agnes
Samba will reject access to everyone other than altair, m-okanochiwa, and agnes. But once they are in the [global] "force user" will convert them all to m-okanochiwa.

BTW, You really should remove the shares you created in Nemo - the one from the "net usershare" output. You're sharing them twice and they will eventually get out of sync. Just keep the smb.conf shares instead.

Re: Cannot share NTFS partition on samba

Posted: Fri Aug 07, 2015 8:54 pm
by CharlieSweatpants
Just wanted to say thanks for this. I've been mucking about in Samba settings trying to get a folder visible on my LAN to Windows and Android machines. It finally dawned on me that I could easily share anything that was in /home but nothing that was in /media (kept getting "no permissions"). Adding that one line to smb.conf did it. Thank you.