Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I wasn't sure whether to post this in the Security Forum or not. If I should have, please feel free to move this post.
Ok... I am having some issues with some of the sites I am developing/hosting. I am utilizing a rather awesome CMS named Joomla. I REALLY like it and am actively developing custom sites and web-apps for people using it. One thing that is killing me about it though is the way that when the CMS writes files to disk, the ownership ends up being nobody.nobody. Which is obviously the user/group that that the webserver is running as. Here is where the problem comes in. I like to go back and edit some of the files that are put in place by the webserver. As the file is not owned by the user I use to connect to my FTP site, I cannot save the file. So I did some testing...
On my linux box at home I created a directory that is owned by a regular user and I set the group to nobody. I then su to root and create a file in this newly created directory and chown it to nobody.nobody. I then give up root and fall back to the regular user. I open the file in vi and force write-quit it. The user now owns the file. Yay!!!!
Unfortunately, I cannot get this same behavior to occur when editing via FTP. So I start thinking... Maybe I can run a cron job and have "find" execute "touch" on the files I ask it to find. Before figuring out the correct find command, I decide to test this on the command line. I quickly realize that touch won't do this for me.
Does anyone know a way that I can make it such that my user can edit these files that are owned by nobody.nobody yet exist in my user's directory? Is there a command that will duplicate whatever it is that vi is doing when it force write-quits a file? Granted, I could script vi to do this over and over but that would be ridiculous. Am I just missing something fundamental about permissions?
If you want more than one user (you and nobody) to be able to edit the files, you will need to add group write permissions to the files in the directory, and make sure both users are in the group nobody (actually, you only need to make sure the user that DOESN'T own the file is in nobody, but adding both won't hurt). Otherwise, if you make it so you can ftp into the box and change files, then the Joomla software will not be able to modify files, and if it is able to modify files, then you will not be able to. If you are hosting Joomla on a machine you control, then you can add yourself to the nobody group (although, you probably want to run Apache as apache:apache instead and add yourself to the apache group, but that's a different rant). You will then need to modify the permissions on the files and directories in Joomla (although you probably only need to modify the files and directories under the templates directory (unless you are programming modules yourself):
# cd /path/to/joomla
# chmod -R g+w .
or change "." to "templates" if you just want to modify the templates directories. If you are just modifying a particular template, you can just change that one instead of all of them by doing:
# cd /path/to/joomla/templates
# chmod -R g+w my_template
If you don't have root control over the server, then this won't work. Post back if this doesn't work, and I'll try to walk you through any issues.
In that case, you may need to delete (or move) the file on the server, and then upload your file. Just make sure that you have the file backed up somewhere.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.