Question: **My stuation**
I'm using windows 8 and building a local web development box with archlinux (just a bare setup... LAMP and Ruby for sass and compass) inside virtual box. I shared one of my folder inside Linux using samba to be able to view and edit it within windows 8. I set the folder inside Linux to http:http and 0777 write permissions for me to be able to edit it within windows.

**My problem:** 
Whenever I'm creating new files (eg... images, folder, files) within windows the ownership and group is set to nobody:nobody. 

**My question:** 
Is there a way when i create a new file in windows, the owner and group will be automatically set to http:http and 0777 write permission?

I'm new to Linux and I know this a security risk but this is only a web development box. just for me to be able to play with ruby and rails, sass or compass and of course expanding my little knowledge in Linux fromscratch.

Answer: 
Edit smb.conf

* for security reason set a static ip on windows 8 eg (192.168.1.50) so that no one can access your samba shared directory. On your smb.conf uncomment **`host allow`** and set it to your windows static ip.

example:

```
host allow = 192.168.1.50

```

Next navigate down to share section and set the directory you want to share.

example:

```
[www]
comment = www
path = /www
writable = yes
guest ok = yes
public = yes
created mask = 0777
directory mode = 0777

```

then save.

next is setui and setgid
more info [here](http://www.omnisecu.com/gnu-linux/redhat-certified-engineer-rhce/linux-setuid-and-setgid.htm) 

```
$sudo chmod -R g+s /www

```

next is Set Access control lists. \* i just got this from [here](https://superuser.com/questions/435285/default-permissions-with-setfacl)

```
$sudo setfacl -R -m d:g:http:rwx /www

```

Thats it!

Output sample, Test via windows 8 and virtualbox

created directory from linux

```
drwxrwsrwx+ 2 devbox http 4096 Mar 12 10:18 testfromnix

```

created file from linux

```
-rw-rw-rw-+ 1 devbox http 1 Mar 12 10:20 testfromnix.file

```

(ive set the rwx at the setfacl but the file shows only read and write. I might be missing something. but its ok it serves your purpose. If someone knows why its open for clarification.)

created directory from windows

```
drwxrwsrwx+ 2 nobody http 4096 Mar 12 10:27 testfromwin

```

created file from windows

```
-rwxrwxrw-+ 1 nobody http 0 Mar 12 10:29 testfromwin.file

```

now you can edit or add files/directories in both machine with no problem...
You can set the "setgid" flag on the directory (=folder), which will change the owning group for all files and directories created below it afterwards. See <http://en.wikipedia.org/wiki/Setuid#setuid_and_setgid_on_directories> for a more detailed explanation.

Unless you need something special that should be completely sufficient for your needs. Just set proper group permissions to the directories as well.

Another way would maybe be changing the samba configuration to use a different user for creating new files. But that's for someone else to answer :)