6

I've been trying to enable writing from Windows 7 to a samba share mapped to a NTFS-formatted USB Disk for the last 3 hours without any success.

I can access the mount point without any issues from the Ubuntu server itself, but no matter how I mount it I always get "You need permission to perform this action" when attempting to create/modify/delete files/folders from my Windows 7 computer.

I'm now out of ideas, so help is very much appreciated!

Samba configuration:

[global]
server string = serv
netbios name = serv
workgroup = WORKGROUP
wins support = yes

guest account = nobody

security = user
map to guest = bad user
encrypt passwords = true
passdb backend = tdbsam
obey pam restrictions = yes
unix password sync = no
pam password change = no

; lanman auth = yes
ntlm auth = no
lanman auth = no
client ntlmv2 auth = yes

socket options = TCP_NODELAY IPTOS_LOWDELAY SO_KEEPALIVE SO_RCVBUF=8192 SO_SNDBUF=8192

load printers = no
printable = no

log file = /var/log/samba/log
log level = 3
max log size = 1024
syslog only = no
syslog = 0

[external]
comment = "External USB Drive"
path = /media/usb0
browseable = Yes
force user = media
force group = media
read only = No
public = yes
guest ok = yes
create mask = 0666
directory mask = 0777
hide dot files = false

Directory permissions:

drwxr-xr-x 11 root  root  4096 Nov 28 17:51 /media/
drwxrwxrwx  2 media media 4096 Nov 28 17:51 /media/usb0/
# (media gid=1001 uid=1001)

Attempted mount options:

sudo mount -t ntfs-3g -o uid=1001,gid=1001 /dev/sdb1 /media/usb0
sudo mount -t ntfs -o uid=1001,gid=1001 /dev/sdb1 /media/usb0
sudo mount -t ntfs -o uid=1001,gid=1001,umask=000 /dev/sdb1 /media/usb0
sudo mount -t ntfs -o uid=1001,gid=1001,umask=000,defaults,users,locale=en_US.UTF-8 /dev/sdb1 /media/usb0
mogelbrod
  • 141
  • 1
  • 1
  • 8
  • Why do you have user & group 'media'? Do you have the same user account on Windows that maps to that? Also what's the output on the server in the log in /var/log/samba/__ip__? Check the permissions that are shown there by the samba service. – koullislp Dec 02 '15 at 13:40
  • `media` is just a user I'm using as an owner of all samba/ftp/etc. shares for simplicity. I've got another samba user (that also belongs to the `media` group) which I'm authorizing as on the windows machine that has no problems reading/writing to other standard samba shares belonging to the same media user. I [created a gist](https://gist.github.com/mogelbrod/210ca31245ac870521e5) with the output from /var/log/samba/log for two different write operations. Thanks for your response! – mogelbrod Dec 03 '15 at 20:52
  • So the samba share is on an Ubuntu machine residing on an NTFS partition? Did you use a user mapping or did you use the same user name on the Windows and Ubuntu machine? (or neither?) Please tell me if you don't understand the questions... – Fabby Dec 06 '15 at 14:28
  • The ubuntu machine has a NTFS formatted USB drive connected and mounted using the mount commands listed in the question. I've created a samba user on the ubuntu server using smbpasswd, which I can authenticate with from the windows machine. I've got other shares with the exact same samba configuration that works perfectly, so the cause of the problem is most likely how the drive is mounted. – mogelbrod Dec 07 '15 at 18:10

3 Answers3

3

Simply renaming the share to something else seemed to have fixed the issue. Got the idea from this serverfault answer.

mogelbrod
  • 141
  • 1
  • 1
  • 8
0

It might be silly of me to ask, but have you tried the solution given in here ?

I would suggest you to first try to set your

create mask = 0755

and then if it didn't work, try following exactly the same steps.

  • Adding the execute bit to the create mask in the samba config did nothing unfortunately. I've tried the solution you linked to (using `uid=1001,gid=1001` where 1001=media as options when mounting) without success. – mogelbrod Dec 08 '15 at 19:42
-1

[2015/12/03 21:49:01.868322, 3] ../source3/smbd/dosmode.c:158(unix_mode) unix_mode(test) returning 0666

[2015/12/03 21:49:01.868789, 2] ../source3/smbd/open.c:972(open_file) media opened file test read=No write=No (numopen=2)

Despite the fact that samba returns default 0666 permissions, the files have no rw access. And since you mentioned that on Linux side is fine try adding this option in the config:

writeable = yes

Default is 'no', which must mean that the share is read only.

This is just a wild guess. Anything can be wrong with these smb shares :-P

koullislp
  • 206
  • 1
  • 7