# How make RW access file in /tmp for two users



## aircrazy (Apr 4, 2014)

I have program, ported from linux, and share data between some users in system. Program executed under two different users, who enter one group, and periodical created files in /tmp. In normal case progs  may read and write file created another user. 

But under FreeBSD files created with directory group, in my case 'wheel' group. I not understand different behaviour FreeBSD and Linux (Ubuntu). 

In Linux `touch /tmp/testfile`:

```
-rw-rw-r-- 1 aircrazy aircrazy       0 Apr  4 12:57 testfile
```

In FreeBSD:

```
-rw-rw-r-- 1 aircrazy wheel       0 Apr  4 12:00 testfile
```

Please, explain this or give link for documentation.


----------



## SirDice (Apr 4, 2014)

Please provide the output of `id aircrazy` and `ls -ld /tmp`.


----------



## aircrazy (Apr 4, 2014)

```
id aircrazy
uid=1001(aircrazy) gid=1001(aircrazy) groups=1001(aircrazy)

ls -ld /tmp
drwxrwxrwt+ 8 root wheel 512 apr  3 23:05 /tmp
```


----------



## SirDice (Apr 4, 2014)

It looks like you have an ACL on /tmp. Why?

`getfacl /tmp`


----------



## aircrazy (Apr 4, 2014)

```
#file: /tmp
#owner: root
#group: wheel
user::rwx
group::rwx
group:aircrazy:rwx
mask::rwx
other::rwx
```
Try override permission, but it not works. I removed ACLs.


----------



## SirDice (Apr 4, 2014)

I actually think the Linux behaviour is wrong. As far as I know POSIX defines the sticky bit on a directory as writeable by the owner, the group of the directory or the superuser (root). However, in Linux's case everybody in the aircrazy group would also be able to edit the file. This is not what is defined in POSIX.


----------



## aircrazy (Apr 4, 2014)

Оkay.
For write access for this file to another user I must change group who included me and another user?


----------



## SirDice (Apr 4, 2014)

aircrazy said:
			
		

> For write access for this file to another user I must change group who included me and another user?


Yes, and of course set the correct permissions so the group can write.


----------

