LinuxQuestions.org
Visit Jeremy's Blog.
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 08-25-2016, 12:31 AM   #1
wh33t
Member
 
Registered: Oct 2003
Location: Canada
Posts: 922

Rep: Reputation: 61
Cool 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?

Any tips greatly appreciated.
 
Old 08-26-2016, 08:10 AM   #2
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,504

Rep: Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489
Quote:
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.
 
Old 08-26-2016, 02:24 PM   #3
wh33t
Member
 
Registered: Oct 2003
Location: Canada
Posts: 922

Original Poster
Rep: Reputation: 61
Quote:
Originally Posted by yancek View Post
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 View Post
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?
 
Old 08-26-2016, 06:04 PM   #4
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,504

Rep: Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489
Quote:
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.
 
1 members found this post helpful.
Old 08-26-2016, 06:05 PM   #5
Rinndalir
Member
 
Registered: Sep 2015
Posts: 733

Rep: Reputation: Disabled
So it's an editor for writing html? Or is it an editor that runs in a web browser?
 
1 members found this post helpful.
Old 08-26-2016, 06:33 PM   #6
wh33t
Member
 
Registered: Oct 2003
Location: Canada
Posts: 922

Original Poster
Rep: Reputation: 61
Quote:
Originally Posted by Rinndalir View Post
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.
 
Old 08-26-2016, 06:35 PM   #7
Rinndalir
Member
 
Registered: Sep 2015
Posts: 733

Rep: Reputation: Disabled
Are you using a web framework or is it just CGI?
 
1 members found this post helpful.
Old 08-26-2016, 07:02 PM   #8
wh33t
Member
 
Registered: Oct 2003
Location: Canada
Posts: 922

Original Poster
Rep: Reputation: 61
Quote:
Originally Posted by Rinndalir View Post
Are you using a web framework or is it just CGI?
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.
 
  


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
How to setup file permissions for multiple groups/users that use Windows AND Linux unassassinable Linux - Security 4 11-02-2010 08:00 PM
HTML Editor dougle25 Linux - Newbie 5 09-19-2008 04:16 AM
Best HTML editor web250 Linux - Software 7 07-11-2007 01:08 AM
saving html from windows editor looses permissions aryehb Linux - Newbie 4 03-24-2005 02:20 PM
html editor c0c0deuz Linux - Software 2 12-06-2003 03:45 PM

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

All times are GMT -5. The time now is 09:40 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