I just set up a apache server on my Raspberry pi. To make the development easier I shared the /var/www/html folder with samba.
I'm able to create new files from my computer in the Pi folder, but they have the following permission : -rwxrw---- 1 pi pi 52 juin 10 17:54 test.php
With those permissions Apache is not able to read the file.
So each time I need to send the following command to make the file readable by Apache : chmod a+rwx test.php
Then my permission are : -rwxrwxrwx 1 pi pi 52 juin 10 17:54 test.php
So ok, after sending this command, it's works... But I am trying to find the command to set up the default file permissions to "-rwxrwxrwx " I'm new with linux so maybe it's easy to fix.... Do you have any ideas ?
Thanks a lot, Maxime
For changing default permissions of the file created, you can use umask
command. umask
is user mask which is used whenever a new file is created.
umask
is a three digit number with octal base. First digit decides the user permissions, second is for group while third determines the permissions for others.
umask
value is used in inverted/complemented form though. That means to determine the required umask
value for the permissions you want, subtract the permissions (in octal form) from 666. The result should be used as your umask
value. e.g. if you want to set default permissions to rw-r--r--
(which is 644 in octal) subtract 644 from 666. The result (022) is your umask value.
To set value for umask
you can simply use:
umask 022
command.
For your case here, I think you can use
umask 000