Setup my own HTML editor. How should I set up permissions and groups for this?
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
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.
Setup my own HTML editor. How should I set up permissions and groups for this?
I've built a simple web editor using Code Mirror. I can't seem to wrap my mind around how the permissions work for such a thing. Essentially I need to make it so one particular script can over write and create new files anywhere in the webroot. The editor is also in the webroot fyi.
Server is Ubuntu Server 16.04 LTS
Just to confirm:
1. When using this web editor from a web browser, when it attempts to save a file to the webroot it will be using the permissions and groups of www-data right?
2. If I add my username to the www-data group, will that allow my username (wh33t) and www-data to alter files in the webroot? I will still sometimes need to edit the files with a regular text editor and I'll be doing that over SSH as my username or locally at the machine (VM).
3. Finally, what permissions do I need to set on the entire webroot to make each file editable?
1. When using this web editor from a web browser, when it attempts to save a file to the webroot it will be using the permissions and groups of www-data right?
I would expect it to be using the permissions of the user you are running as.
Quote:
If I add my username to the www-data group, will that allow my username (wh33t) and www-data to alter files in the webroot?
Not unless you have given the www-data group write permissions which would of course, give any member of www-data write permissions.
If you want to edit files in a sub-directory of the /var/www/html (or whatever your Document Root is) you can change the ownership of the directories to your user on the local machine. I don't know how you would do it over SSH, I don't use it.
I would expect it to be using the permissions of the user you are running as.
And what user is it that serves web pages? www-data right?
Quote:
Originally Posted by yancek
If you want to edit files in a sub-directory of the /var/www/html (or whatever your Document Root is) you can change the ownership of the directories to your user on the local machine. I don't know how you would do it over SSH, I don't use it.
Yes, but I still need the files to be able to be served over the web. Am I over complicating this?
And what user is it that serves web pages? www-data right?
Your question is about editing files you have in your Document Root, the standards being /var/www/html or /home/user/public_html.
In the first instance, the directories/files in /var/www/html can be owned by the user and should be if you want to edit them as a user. In your case that would be wh33t.
If you use the standard public_html directory in /home/wh33t, the owner:group would be wh33t:wh33t.
If you have some other non-standard location, I don't know. The above works for me in both instances but this is just on a localhost. Obviously, there are other settings necessary and I don't really use apache enough to give any more advice.
So it's an editor for writing html? Or is it an editor that runs in a web browser?
Yes, basically you login to a back end over the web, and there is a directory browser and a code editing window so you can build and update the site entirely through the website itself.
It's part of my own CMS system I've steadily been building and using for live clients over the years. It's all written in plain PHP/JS/Mysql with a bit of Bash and Cron jobs.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.