LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Whats the best way to handle files for www-data (https://www.linuxquestions.org/questions/linux-newbie-8/whats-the-best-way-to-handle-files-for-www-data-4175580069/)

White-Gandalf 05-18-2016 02:27 AM

Whats the best way to handle files for www-data
 
Yes, sorry for the humble question. It takes a little bit more than a single line to describe the intend...

On a regular basis, it happens that i forget to change ownerschip of some files in the /var/www/ area after synchronizing something with the server and eventually doing some debugging.

Since i have to scp under the root account (i am not having ownership of the web server; the person responsible for that thing insisted having me login as root - not my responsibility nor in any way changeable, even if you would like me to do), the files and directories i have to handle mostly end up being changed to ownership of root, thus making the php scripts unable to write to certain locations - where there are a lot of.

Thus i regularly end up leaving some of the files or directories in root ownership, and thus having users complaining about non functional web applications.

Thus to my question: To migitate forgetting to change the ownership of those damned files, is there a way to automate it, so that every file, whose ownership was www-data and which becomes changed, automatically gets ownership reset to "www-data"? (Well: i eventually will get this done via a batch script, but since im still not familiar with linux (instead coming from windows), this is something i like to postpone into the future, if possible...)

Or is there a reliable way to accomplish this (respectively prevent changing ownership at all) via configuration of file system rights?

(My xp level in unix is still fairly low...)

ardvark71 05-18-2016 10:44 AM

Hello and welcome to forum :)

Please watch the language, in part because folks from different age ranges use these forums.

Also, please note this forum is for introductions only. Please resubmit your question in either the "Newbie" or another appropriate forum. Thanks! ;)

Regards...

rtmistler 05-18-2016 10:58 AM

Welcome to the forums. To request your thread be moved, you can click on the report button. You also can change the title of the thread to something matching your question.

White-Gandalf 05-18-2016 11:17 AM

@ardvark71: Sorry, i was forced by the forum itself to post the very first question, whatever it would be, in this "LinuxQuestions.org Member Intro" Area. No way to prevent that. Wrong address (i'm in no way able to force anything on the owners of this forum)...

Aside of that: Which terms of my language do you regard as offensive? I have thoroughly reviewed the question and cannot find anything applicable to terrorist banning rules. If you have rules in place that were not covered by the usage agreement, could you please point me to the direction of their documentation?

Not a very warm welcome! Maybe i should go looking somewhere other...

rtmistler 05-18-2016 11:24 AM

OK, please calm down.

In an effort to be helpful and proactive I have asked a moderator to move this thread to LQ Newbie, please wait as much as 1/2 day or 1 day for that to happen, they work fast, but everyone sometimes is not online all the time. :)

Not a huge deal, but you used a swear word and LQ rules are that profanities are not allowed in any form, regardless of how light or heavy they are.

You used "d...mned", just once that I can see, it's not so very heinous, however it is technically a profane word, just a heads up there.

There have been discussions such as how bad is bad, and the general conclusion is that any use of the slightest slang/profane word should just be noted as "inappropriate". People can get childish about it, people can get offended that a very slight/questionable word is deemed bad. Not much we can do, and if you use that word generally sparingly, nothing likely will ever come of it or happen to you except maybe Jeremy once or twice commenting to try avoid profanities. If you use much worse, in large supply, that'd be a very different case.

As far as the posting limits/etc. I was unaware that you had to first post to the intro forum.

[Perhaps you can use the report button to request a moderator to move your thread. That is how it's done in spite of the implication that "report" sounds negative.] I've already done this.

Or, you could try to visit the Newbie forum and create a new thread there.

Once again, Welcome to the forums.

Regarding your question:

Without getting fully detailed into your question, I will say that it is possible at a top level to do some things like:
Code:

sudo chown -R <new-owner> *
sudo chgrp -R <new-group> *

However you do NOT do that at the ultimate top level of "/", you would say do that in your /home/user-name directory if you've found that files are not owned by your user and in your group. The sudo gives temporary super user privileges to your signon for executing those commands and the first time you issue it you should have to enter your user password as a security measure. The -R flags will recurse into directories. The "*" is a wildcard which will do it to everything, hence the notation to not do this in a directory where it will affect root, or other user's things. And finally those commands are to change ownership and change group. If you do a long listing, "ls -l" of your files, you'll see the owner, as well as the group and other information on a file. Files you own should also be in the same group as your user.

EDIT: Note that Aardvark71 is regularly on the forums and typically very helpful to many members. I'm certain they meant no offense. Please bear in mind that people entering the forums many, many times ask very limited questions. You did not, and even acknowledged that you felt you were limited in thread access. This should not be the case moving forwards and what Aardvark71 and myself are trying to do here is give you guidance for moving forwards for some ideas how to move threads or start new threads to get effective exposure for your questions.

ardvark71 05-18-2016 11:58 AM

Quote:

Originally Posted by White-Gandalf (Post 5547284)
Aside of that: Which terms of my language do you regard as offensive? I have thoroughly reviewed the question and cannot find anything applicable to terrorist banning rules. If you have rules in place that were not covered by the usage agreement, could you please point me to the direction of their documentation?

Hi...

I was referring to the swear word towards the end of your post that rtmistler mentioned. In terms of the rule that would cover this, I believe it's this one...

Quote:

Do not post any messages that are obscene, vulgar, sexually-orientated, hateful, threatening, hostile or insulting.
Quote:

Originally Posted by White-Gandalf (Post 5547284)
Not a very warm welcome! Maybe i should go looking somewhere other...

I wasn't trying to be unfriendly, just attempting to help you understand forum rules and as rtmistler alluded to, to "get you on the right track," so to speak. I was not aware that LQ
required all new members to post in this forum first. I hadn't even heard of that. Perhaps Jeremy or one of the moderators could provide confirmation of this. :confused:

Regards...

rtmistler 05-18-2016 01:39 PM

Quote:

Originally Posted by White-Gandalf (Post 5547284)
@ardvark71: Sorry, i was forced by the forum itself to post the very first question, whatever it would be, in this "LinuxQuestions.org Member Intro" Area. No way to prevent that. Wrong address (i'm in no way able to force anything on the owners of this forum)...

I believe this to be an untrue assumption. Just create a thread in another forum.

Presently the new user in the following link has made exactly two posts, one to start their thread and one to say "thanks", the thread is not in the New Member Intro forum, but in the Newbie forum: http://www.linuxquestions.org/questi...or-4175580091/

To add to that, I'm positive I've encountered plenty of "first posts" in Newbie and Software forums.


All times are GMT -5. The time now is 06:43 PM.