2

I have a Windows 7 box and a Linux machine. I can correctly access the files on the Windows machine from the Linux machine. however, when I look at the permissions from Linux and from Cygwin on my Windows box they are not the same.

My understanding was that natively the filesystem permissions are managed by access control lists (ACL's) which are mapped to POSIX filesystem permissions (which are a subset of ACLs) by both Cygwin and by Samba when it connects, is that correct? Do I need to enable something in my samba.conf to do this?

# Linux machine (incorrect file permissions)
» ll .gitignore
-rwx------ 1 michael users 57 Oct 28 10:41 .gitignore
# Windows machine (via cygwin, correct file permissions)
$ ll .gitignore
-rw-r--r-- 1 hauserra Domain Users 57 Oct 28 10:41 .gitignore

Is there any way to get these two boxes to be speaking the same file-permissions language so that I can modify the files on the windows box from Linux without breaking things horribly?

slm
  • 369,824
Mike H-R
  • 259
  • 3
  • 12
  • Try using sshfs or even a direct 'mount'. Are you using smbmount or something else? –  Oct 28 '14 at 18:04
  • @barrycarter I'm mounting it and using the smb protocol. I've (finally) actually got a solution that works (with one small problem that I want to try and fix) which I'll post when I'm back at the computer with the info on it. I actually think I prefer your idea of using sshfs though as it skips (what I consider to be) the ugliness of windows ACL hell (as the sshdaemon would be running on cygwin). I'll try that as an alternative tomorrow and write up the solution. Thanks barry. – Mike H-R Oct 28 '14 at 18:28

1 Answers1

1

So I was very close to an answer using smb but on coming back to my computer, it stopped recognizing the other computer, I will describe that solution and then the (in my opinion simpler) solution I used along with mentioning the advantages and drawbacks of both.

My first solution was to try and get smb to recognize windows ACL's so that it would translate the permissions to their correct posix permissions, this worked up to a point where the user that had created the file would not show up (c.f. this question). This produced an acceptable enough result (file permissions were transferred correctly between the two computers and modifying the file on the linux side would not modify any permissions, which was my desired goal). This worked correctly through restarts but coming in the next day had stopped working (network issue I think). In order to get the directory automounting I did the following:

#smb.conf
[global]
...
inherit acls = Yes
map acl inherit = Yes
acl group control = yes

in smb.conf

#/etc/fstab
//YourServerName/YourSharedFile /mnt/host cifs cifsacl,user=bar,password=foo,workgroup=WorkGroup,ip=your_ip_address_of_server 0 0

you can also add an authentication file so that your password and username are at least protected.

However this wasn't the nicest solution so on the advice of @barrycarter in the comments I decided to use sshfs (which is wonderfully simple).

Detailed instructions for setting it up are located here but the main command that is relevant is

sshfs USERNAME@HOSTNAME_OR_IP:/PATH LOCAL_MOUNT_POINT SSH_OPTIONS

Now on to the comparison between them. This benchmark actually seems to suggest that sshfs is actually faster than samba, but there appear to be a lot of different opinions on that. It is definitely much simpler to set up.

Mike H-R
  • 259
  • 3
  • 12