Frustrated with Permissions Issues

I cannot get permissions to ever "just work" with my VPS (Debian 7.5 using LAMP Stack script). I'll try owning files with my user account then the scripts quit working because they are not running as the owner of Apache (e.g., wordpress can't install plugins or update itself). So then I Chown the files to www-data:www-data and it starts working again, but then I can't overwrite files with FTP without chowning them back to my user account.

Can anyone enlighten me on how I can make it "just work". And I am willing to sacrifice some security to allow my scripts to do their thing. Essentially, on all the shared hosts Ive worked with in the past, I've never had any permissions issues. Now I feel like the most simple tasks turn into nightmares because permissions are acting up.

Examples:

Wordpress install folder:

otal 6748
-rw-r--r--  1 www-data www-data     418 Sep 25  2013 index.php
-rw-r--r--  1 www-data www-data   19930 Apr  9  2014 license.txt
-rw-r--r--  1 www-data www-data    1061 Jan 10 15:39 permissions.sh
-rw-r--r--  1 www-data www-data    7193 Sep 29 13:24 readme.html
-rw-r--r--  1 www-data www-data 6718759 Jan 10 15:26 wordpress-4.1.zip
-rw-r--r--  1 www-data www-data    4951 Aug 20 17:30 wp-activate.php
drwxr-xr-x  9 www-data www-data    4096 Dec 18 18:18 wp-admin
-rw-r--r--  1 www-data www-data     271 Jan  8  2012 wp-blog-header.php
-rw-r--r--  1 www-data www-data    5008 Nov 26 20:17 wp-comments-post.php
-rw-rw-rw-  1 www-data www-data    3017 Jan 10 15:40 wp-config.php
-rw-r--r--  1 www-data www-data    2726 Sep  9 01:23 wp-config-sample.php
drwxr-xr-x  8 www-data www-data    4096 Jan 11 11:41 wp-content
-rw-r--r--  1 www-data www-data    2956 May 13  2014 wp-cron.php
drwxr-xr-x 12 www-data www-data    4096 Dec 18 18:18 wp-includes
-rw-r--r--  1 www-data www-data    2380 Oct 24  2013 wp-links-opml.php
-rw-r--r--  1 www-data www-data    2714 Jul  7  2014 wp-load.php
-rw-r--r--  1 www-data www-data   33435 Dec 16 22:19 wp-login.php
-rw-r--r--  1 www-data www-data    8252 Jul 17 09:12 wp-mail.php
-rw-r--r--  1 www-data www-data   11115 Jul 18 09:13 wp-settings.php
-rw-r--r--  1 www-data www-data   25152 Nov 30 21:23 wp-signup.php
-rw-r--r--  1 www-data www-data    4035 Nov 30 21:23 wp-trackback.php
-rw-r--r--  1 www-data www-data    3032 Feb  9  2014 xmlrpc.php

ETC/Group

austin@xxxx~/public/xxxx/public/new$ cat /etc/group
root:x:0:
daemon:x:1:
bin:x:2:
sys:x:3:
adm:x:4:
tty:x:5:
disk:x:6:
lp:x:7:
mail:x:8:
news:x:9:
uucp:x:10:
man:x:12:
proxy:x:13:
kmem:x:15:
dialout:x:20:
fax:x:21:
voice:x:22:
cdrom:x:24:
floppy:x:25:
tape:x:26:
sudo:x:27:austin
audio:x:29:
dip:x:30:
www-data:x:33:austin
backup:x:34:
operator:x:37:
list:x:38:
irc:x:39:
src:x:40:
gnats:x:41:
shadow:x:42:
utmp:x:43:
video:x:44:
sasl:x:45:
plugdev:x:46:
staff:x:50:
games:x:60:
users:x:100:
nogroup:x:65534:
libuuid:x:101:
crontab:x:102:
Debian-exim:x:104:
mlocate:x:105:
ssh:x:106:
ntp:x:103:
ssl-cert:x:107:
postfix:x:108:
postdrop:x:109:
mysql:x:110:
austin:x:1000:
webmasters:x:1001:austin,tim

/etc/passwd

austin@xxxx:~/public/xxxx/public/new$ cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/bin/sh
man:x:6:12:man:/var/cache/man:/bin/sh
lp:x:7:7:lp:/var/spool/lpd:/bin/sh
mail:x:8:8:mail:/var/mail:/bin/sh
news:x:9:9:news:/var/spool/news:/bin/sh
uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
proxy:x:13:13:proxy:/bin:/bin/sh
www-data:x:33:33:www-data:/var/www:/bin/sh
backup:x:34:34:backup:/var/backups:/bin/sh
list:x:38:38:Mailing List Manager:/var/list:/bin/sh
irc:x:39:39:ircd:/var/run/ircd:/bin/sh
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
libuuid:x:100:101::/var/lib/libuuid:/bin/sh
Debian-exim:x:101:104::/var/spool/exim4:/bin/false
statd:x:102:65534::/var/lib/nfs:/bin/false
sshd:x:103:65534::/var/run/sshd:/usr/sbin/nologin
ntp:x:104:103::/home/ntp:/bin/false
postfix:x:105:108::/var/spool/postfix:/bin/false
mysql:x:106:110:MySQL Server,,,:/nonexistent:/bin/false
austin:x:1000:1000:Austin,,,:/home/austin:/bin/bash
newrelic:x:107:111::/.newrelic:/bin/false
tim:x:1001:1001:Tim,,,:/home/austin/public:/bin/bash

2 Replies

Easiest solution would be to add yourself to the www-data group and make all files you want to modify group-writable, like so:

usermod -a -G www-data austin
chmod g+w 

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct