LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-18-2016, 08:54 PM   #1
kb2tfa
Member
 
Registered: Oct 2006
Location: New Jersey
Distribution: CentOS
Posts: 175

Rep: Reputation: 18
Assigning default permissions


I'm running Ubuntu 14 LTS with nginx. I have a projects folder that I am working in. I am working in this folder /var/www/html/somedomain.com/projects as root because my user account has no access. This directory is chown to www-data:www-data because there is a wordpress site there, and wordpress gets cranky with you try to upgrade or install things and wordpress is not permissible. The projects folder is not wordpress, but the creation of files are owned by root, and I would like them to be www-data so I don't have to keep running chown.
 
Old 02-20-2016, 02:22 PM   #2
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,510

Rep: Reputation: 2491Reputation: 2491Reputation: 2491Reputation: 2491Reputation: 2491Reputation: 2491Reputation: 2491Reputation: 2491Reputation: 2491Reputation: 2491Reputation: 2491
Is your normal user part of the www-data group?
 
Old 02-20-2016, 04:02 PM   #3
kb2tfa
Member
 
Registered: Oct 2006
Location: New Jersey
Distribution: CentOS
Posts: 175

Original Poster
Rep: Reputation: 18
Quote:
Originally Posted by yancek View Post
Is your normal user part of the www-data group?
No it's not.
 
Old 02-21-2016, 08:37 AM   #4
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,510

Rep: Reputation: 2491Reputation: 2491Reputation: 2491Reputation: 2491Reputation: 2491Reputation: 2491Reputation: 2491Reputation: 2491Reputation: 2491Reputation: 2491Reputation: 2491
If your projects folder is owned by root have you tried to change it to www-data? Simple enough to change back if it doesn't help. I've not used wordpress or nginx but on an Apache server you should be able to have sub-directories owned by a user.
 
Old 02-21-2016, 06:22 PM   #5
kb2tfa
Member
 
Registered: Oct 2006
Location: New Jersey
Distribution: CentOS
Posts: 175

Original Poster
Rep: Reputation: 18
Here's what I've done. sudo chown -R www-data:www-data /var/www/html/*

I also did sudo usermod -aG www-data myusername

I then groups myusername, and I get the following: myusername sudo www-data

I try from user account: touch /var/www/html/myfolder/README This returns a "permission denied" error.

www-data is not a log in account, but wordpress can generate files, however from the commandline, I have to be root or sudo.

This is where permissions get me all screwed up.
 
Old 02-22-2016, 08:37 AM   #6
fmattheus
Member
 
Registered: Nov 2015
Posts: 104

Rep: Reputation: 38
After running "usermod -aG www-data myusername" you need to login again before your current session is in the group. Then you should be able to touch /var/www/html/myfolder/README provided it has group write permissions.

If that didn't work, post the results of
Code:
namei -lx /var/www/html/myfolder/README
 
Old 02-22-2016, 08:39 PM   #7
kb2tfa
Member
 
Registered: Oct 2006
Location: New Jersey
Distribution: CentOS
Posts: 175

Original Poster
Rep: Reputation: 18
Quote:
Originally Posted by fmattheus View Post
After running "usermod -aG www-data myusername" you need to login again before your current session is in the group. Then you should be able to touch /var/www/html/myfolder/README provided it has group write permissions.

If that didn't work, post the results of
Code:
namei -lx /var/www/html/myfolder/README
from user executed touch /var/www/html/README
Code:
Drwxr-xr-x root     root     /
drwxr-xr-x root     root     var
drwxr-xr-x www-data www-data www
drwxr-xr-x www-data www-data html
README - No such file or directory
 
Old 02-23-2016, 01:25 AM   #8
fmattheus
Member
 
Registered: Nov 2015
Posts: 104

Rep: Reputation: 38
Ok, so you need to set the group permissions of everything in /var/www to be writeable.
This command should do that.
Code:
chmod -R g+w /var/www
 
1 members found this post helpful.
Old 03-02-2016, 06:22 AM   #9
kb2tfa
Member
 
Registered: Oct 2006
Location: New Jersey
Distribution: CentOS
Posts: 175

Original Poster
Rep: Reputation: 18
Quote:
Originally Posted by fmattheus View Post
Ok, so you need to set the group permissions of everything in /var/www to be writeable.
This command should do that.
Code:
chmod -R g+w /var/www
that did it. thank you.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] assigning r+w permissions to the appropiate user htamayo Linux - Newbie 5 06-27-2009 08:12 AM
Trouble assigning permissions staph Linux - Newbie 8 02-05-2007 07:00 PM
Assigning Network Share Permissions Woodsman Slackware 2 08-22-2006 09:53 PM
Assigning permissions for a file to be accessed by particular users praveen kumar Linux - Networking 3 05-18-2006 10:20 AM
assigning permissions ziox Programming 1 01-10-2005 09:13 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 11:48 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration