LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-19-2020, 03:14 PM   #1
bulgin
Member
 
Registered: Mar 2010
Posts: 74

Rep: Reputation: Disabled
Confusion on file and directory permissions


Hello.

I am running software on a server which states that the file permissions should be:

cd /var/www/example.com/domain
chown -R $USER:www-data .

However, my server has no www-data account. httpd in centos runs as nobody.

As well. $USER could be anything from root to any other logged in user depending on how they are accessing the server - for example, when I login into the server via ssh I'm root, so in that case the user would root. I can also login as a user with name this-is-my-name in which case the $USER would be this-is-my-name.

So what's the story?
 
Old 02-19-2020, 04:01 PM   #2
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
www-data is not an account, but a group.
My guess is that the documentation of your software assumes you are logged into a certain account, but it's hard to guess the intentions of unknown software.
 
Old 02-19-2020, 04:31 PM   #3
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,799

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Quote:
Originally Posted by bulgin View Post
... for example, when I login into the server via ssh I'm root, so in that case the user would root. I can also login as a user with name this-is-my-name in which case the $USER would be this-is-my-name.

So what's the story?
Interesting that you are using ssh to directly get on the server as root. Normally, I would expect the root user to be restricted to logging into the server at the console. I thought this would be the norm on Linux these days. (Check /etc/securetty for "pts" entries.) I can't recall if the distributions I've been using do it by default or whether I've just gotten used to locking things down as a habit---I've been restricting root's access to either the physical console ("Hey! Who let you into the data center?"), via a "regular" user who has to use "su" to become root (which gets logged), or temporarily becoming root via "sudo" (again, logged). Many (many) years ago, we got called out by the internal auditors for not being as attentive as we should have been about root access on some of the servers we inherited during a corporate acquisition/re-org and had to go about locking things down (after we wiped the egg off our faces). Not allowing root to login directly via the network was the first fix we instituted.

Cheers...
 
Old 02-19-2020, 05:47 PM   #4
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,487

Rep: Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488Reputation: 2488
www-data is specific to Debian/Ubuntu and derivatives so I'm wondering what software you are running on CentOS and where the instructions come from. See post 3 & 4 at the thread linked below.

https://www.linuxquestions.org/quest...-a-4175646418/
 
Old 02-19-2020, 06:11 PM   #5
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,723

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
Quote:
Originally Posted by bulgin View Post
Hello.

I am running software on a server which states that the file permissions should be:

cd /var/www/example.com/domain
chown -R $USER:www-data .

However, my server has no www-data account. httpd in centos runs as nobody.

As well. $USER could be anything from root to any other logged in user depending on how they are accessing the server - for example, when I login into the server via ssh I'm root, so in that case the user would root. I can also login as a user with name this-is-my-name in which case the $USER would be this-is-my-name.

So what's the story?
The current (as of CentOS 7) default user for the web server is apache. It used to be nobody, and as I've upgraded over the years I've found it convenient to just keep it as nobody. The user is defined in the httpd.conf file with the User and Group directives.

In my experience, a directory should only be owned by the web user if there is an application which is creating or writing to files in that directory. Otherwise it is as you say, the content may be owned by any user as long as it's readable by the web user, which is accomplished by having directories permies set to 755 and file permies set to 644.

That said, the software is telling you to just change the group for all files in the directory, and the directory itself, to the user you're logged in as with the group set to your web server's group. See what's set on the Group directive in httpd.conf and replace www-data with that group name. It doesn't (probably) matter which user that is...the point is to change the group.

I too would question what software it is that's instructing that, however. I wonder what those instructions think changing the group will accomplish.
 
1 members found this post helpful.
  


Reply

Tags
httpd server, permissions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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] Permissions Permissions Permissions! makem Linux - Newbie 13 07-30-2015 11:54 AM
File and Directory Permissions using Active Directory Users jokar.mohsen Linux - Security 8 12-28-2014 06:05 PM
MySQL: administration and permissions issue and confusion pellicle Linux - Server 2 06-22-2010 09:04 PM
File permissions v. directory permissions Completely Clueless Linux - Newbie 7 07-09-2009 08:33 AM
getting a directory's permissions and creating a new one with the same permissions newbie1000101 Programming 1 04-10-2004 12:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:51 AM.

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