Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have an Ubuntu development server and a Windows 7 workstation. I use Windows Gvim to edit files on the linux server, over a samba connection.

Saving files from Windows change the Linux permissions in weird way depending on the Windows app I'm using and also depending on whether there's a file extension or not.

Here are some tests

No extension; Notepad2: 644 to 764

matt@mattserver ~ % ls -l testfile
-rw-r--r-- 1 matt matt 0 2011-05-28 07:09 testfile
--- Save from Windows Notepad2 over network ---
matt@mattserver ~ % ls -l testfile
-rwxrw-r-- 1 matt matt 1 2011-05-28 07:09 testfile

No extension; Gvim: 644 to 760

matt@mattserver ~ % ls -l testfile
-rw-r--r-- 1 matt matt 0 2011-05-28 07:10 testfile
--- Save from Windows Gvim over network ---
matt@mattserver ~ % ls -l testfile
-rwxrw---- 1 matt matt 0 2011-05-28 07:11 testfile

Extension; Notepad2: 644 to 644 (good!)

matt@mattserver ~ % ls -l testfile.txt
-rw-r--r-- 1 matt matt 0 2011-05-28 07:13 testfile.txt
--- Save from Windows Notepad2 over network ---
matt@mattserver ~ % ls -l testfile.txt
-rw-r--r-- 1 matt matt 0 2011-05-28 07:13 testfile.txt

Extension; Gvim: 644 to 760

matt@mattserver ~ % ls -l testfile.txt
-rw-r--r-- 1 matt matt 0 2011-05-28 07:14 testfile.txt
--- Save from Windows Gvim over network ---
matt@mattserver ~ % ls -l testfile.txt
-rwxrw---- 1 matt matt 0 2011-05-28 07:14 testfile.txt

Here's the relavant portion of my smb.conf

[matt]
comment = Matt
path = /home/matt
public = yes
writable = yes
valid users = matt
create mask = 0771
directory mask = 0771
force user = matt
force group = matt

I want the permissions to not be affected at all when saving over the samba connection. How do I do that?

share|improve this question

2 Answers 2

up vote 3 down vote accepted

You can try setting in smb.conf the nt acl support to "no" :

This boolean parameter controls whether smbd will attempt to map UNIX permissions into Windows NT access control lists.

Default: nt acl support = yes
Example: nt acl support = no

Another that might help is :

map archive = no

share|improve this answer

I found that neither 'nt acl support = no' nor 'map archive = no' solved the problem. My experience has been that Samba always applies file permissions defined by 'create mask' and 'directory mask', regardless of whether saving a new or existing file.

share|improve this answer
    
so how would you recommend this problem be fixed? –  Fazer87 Jun 10 '14 at 10:28

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.