noze_potato
noze_potato

Reputation: 187

Create new files and folders in directory with 777 permissions

I have a directory named folder, and i want to make that all new files and dirs which creates under this directory creates with 777 permissions, and i was tried to use setfacl command

[vagrant@localhost ~]$ mkdir folder
[vagrant@localhost ~]$ cd folder/
[vagrant@localhost folder]$ touch file
[vagrant@localhost folder]$ ls -l
total 0
-rw-rw-r--. 1 vagrant vagrant 0 Jul 13 10:20 file
[vagrant@localhost folder]$ setfacl -R -m default:other:rwX .
[vagrant@localhost folder]$ setfacl -R -m other:rwX .
[vagrant@localhost folder]$
[vagrant@localhost folder]$ touch file2
[vagrant@localhost folder]$ ls -l
total 0
-rw-rw-rw-. 1 vagrant vagrant 0 Jul 13 10:20 file
-rw-rw-rw-. 1 vagrant vagrant 0 Jul 13 10:21 file2

so as you can see after applying setfacl policies, the new file named file2 creates with default permissions

getfacl folder/
file: folder/
owner: vagrant
group: vagrant

user::rwx group::rwx other::rwx default:user::rwx default:group::rwx default:other::rwx

Upvotes: 1

Views: 3104

Answers (2)

rezshar
rezshar

Reputation: 640

In these cases, I use the following trick, I hope help you. create a crontab on your server and add this line to crontab.

* * * * * chmod 777 /path/to/your/directory -R

Upvotes: 0

roylaurie
roylaurie

Reputation: 1858

umask u=rwx,g=rwx,o=rwx

It's in effect session-wide for the user, though, not per directory.

Upvotes: 1

Related Questions