I've been struggling like hell for 3 days now, can't figure what I did wrong...
EDIT 3: I think my question is more specific than I thought, so I created a new thread here: https://askubuntu.com/questions/631303/make-owner-of-newly-create-files-and-folders-www-data-instead-of-superuser-admin
Here is my setup:
A computer with Ubuntu Desktop and LAMP installed on it. Note that I do not have a static IP and its ONLY purpose is to be able to produce collaborative websites locally with my team as connexions in the Philippines are pretty slow. So (if I'm not wrong) I don't mind much setting everything to 777 if that can solve the problem, but I'd like to learn the right way of doing it for future reference.
I created 5 "users", all in the www-data group (and a newly www-pub group as I was trying to find new ways... I checked both), that connect to the /www/var folder using Samba Share.
I have tried everything so far, without success:
- chmod and chown with the find command using -R for recursive.
- Changing umask to 0002
BUT all my new directories and files are still not writeable unless I run once again the chmod/chown command lines I found on various threads.
I'm a pure newbie on ubuntu and server/command lines and all, but learn quite fast.
Questions:
Can I use a simple chmod 777 rule (and what is the exact way to do that) since it is for production but without access to the world?
What is the step-by-step process to do this?
Can it simply be something else? Apache config? Should it be referenced all the time?
I am LOST !
Thanks in advance
EDIT: Thought this might help:
ls -l /var/www
total 4
drwxrwsr-x 8 www-data www-data 4096 Jun 2 17:56 html
-rw-rw-r-- 1 www-data www-data 0 May 27 01:40 Untitled Document~
ls -l /var
total 52
drwxr-xr-x 2 root root 4096 Jun 2 10:29 backups
drwxr-xr-x 21 root root 4096 May 28 12:49 cache
drwxrwsrwt 2 root whoopsie 4096 May 28 11:56 crash
drwxr-xr-x 71 root root 4096 May 27 11:23 lib
drwxrwsr-x 2 root staff 4096 Apr 18 05:34 local
lrwxrwxrwx 1 root root 9 May 11 23:05 lock -> /run/lock
drwxrwxr-x 16 root syslog 4096 Jun 2 17:53 log
drwxrwsr-x 2 root mail 4096 Apr 22 20:13 mail
drwxrwsrwt 2 root whoopsie 4096 Apr 22 20:19 metrics
drwxr-xr-x 2 root root 4096 Apr 22 20:13 opt
lrwxrwxrwx 1 root root 4 May 11 23:05 run -> /run
drwxr-xr-x 9 root root 4096 May 26 18:46 spool
drwxrwxrwt 12 root root 4096 Jun 2 17:59 tmp
drwx------ 2 root bin 4096 Jun 2 10:21 webmin
drwxrwsr-x 4 www-data www-data 4096 May 29 15:37 www
EDIT 2:
I have seen something peculiar when running ls -l on the folder where my websites are, which is /var/www/html , might give more hints? The new ones created today are not owned by www-data but by the main admin of the server ("boris")
ls -l /var/www/html
drwxrwsr-x 2 boris www-data 4096 May 29 15:38 Agama
drwxrwsr-x 6 www-data www-data 4096 May 27 18:21 calima
drwxrwsr-x 6 www-data www-data 4096 May 27 23:19 calima2
drwxrwsr-x 6 boris www-data 4096 Jun 2 17:21 cheche
drwxrwsr-x 9 boris www-data 4096 Jun 2 18:17 Cheche1
-rw-rw-r-- 1 www-data www-data 11321 May 26 18:19 index.html
-rw-rw-r-- 1 www-data www-data 20 May 27 01:41 index.php
drwxr-sr-x 2 boris www-data 4096 Jun 2 17:56 Test
chown -R www-data:www-data /var/www
, thenchmod -R 774 /var/www
. It will fix the linux permissions on files and folders for the group www-data. Now you have to create the permissions on Samba.