4

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
2
  • Issue chown -R www-data:www-data /var/www, then chmod -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.
    – jcbermu
    Jun 2, 2015 at 9:35
  • I've done that in the past, problem is if I create a new folder (or if php does, for example when running an install using the duplicator plugin for WordPress) then I do not have the permission to write in any of the newly created directories Jun 2, 2015 at 9:46

1 Answer 1

-1

I would use a symlink to another directory:

ln -s <target> <link>

EDIT: To be more precise: You could do something like this:

ln -s /var/www /path/to/link

Doing this protects the system as your rootdirectory is still only read only (as user). Having a symlink-directory somewhere in your homepath is the saver way for tinkering with your project. I wouldn´t use it for a production system tho.

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .