LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   htdocs root permissions? (https://www.linuxquestions.org/questions/linux-newbie-8/htdocs-root-permissions-276152/)

technician 01-10-2005 12:49 PM

htdocs root permissions?
 
I'm having trouble getting files inserted into htdocs to be viewable on the web. Right now only root can edit/add/remove files under /var/www/htdocs. I'd like to make it so that other users are able to access it, especially from FTP.

I thought I had to set the "ownership" of the htdocs folder to the www username (that is what runs Apache under my slackware install), although I might wrong. Even if I was right I can't remember the commands to make it so :\

Anyone willing to help me out of this pickle?

bulliver 01-10-2005 01:21 PM

run "ls -l /var/www/htdocs/" and post results.

Files need to be world-readable (or readable by user apache runs as...) to view on the web (chmod a+r filename)

technician 01-10-2005 01:48 PM

Quote:

cgoff@www:~/public_html$ ls -l /var/www/htdocs/
total 71
drwxr-xr-x 5 cgoff users 560 2005-01-10 02:33 admin/
-rw-r--r-- 1 cgoff users 9746 2005-01-10 02:33 dwcms.xml
-rw-r--r-- 1 cgoff users 3644 2005-01-10 02:33 feedback.php
drwxr-xr-x 2 cgoff users 392 2005-01-10 02:33 images/
drwxr-xr-x 2 cgoff users 240 2005-01-10 02:33 includes/
-rw-r--r-- 1 cgoff users 2559 2005-01-10 02:33 index.php
-rw-r--r-- 1 cgoff users 2702 2005-01-10 02:33 index2.php
-rw-r--r-- 1 cgoff users 1381 2005-01-10 02:33 missing.php
drwxrwxrwx 11 cgoff users 296 2005-01-10 02:33 myimages/
drwxrwxrwx 2 cgoff users 48 2005-01-10 02:33 myuploads/
drwxr-xr-x 7 52400 users 3104 2004-11-18 17:34 phpMyAdmin-2.6.0-pl3/
-rw-r--r-- 1 root root 64 2005-01-09 23:13 phpinfo.php
-rw-r--r-- 1 cgoff users 1018 2005-01-10 02:33 print_template.css
-rw-r--r-- 1 cgoff users 963 2005-01-10 02:33 print_template.php
-rw-r--r-- 1 cgoff users 1826 2005-01-10 02:33 printfriendly.php
-rw-r--r-- 1 cgoff users 79 2005-01-10 02:33 redirect.php
-rw-r--r-- 1 cgoff users 2705 2005-01-10 02:33 results.php
-rw-r--r-- 1 cgoff users 4124 2005-01-10 02:33 sendpage.php
-rw-r--r-- 1 cgoff users 867 2005-01-10 02:33 show_image.php
drwxr-xr-x 11 cgoff users 320 2005-01-10 02:33 templates/
cgoff@www:~/public_html$
That's the report I get back from running the command you gave me.

I should note viewing the files is not a problem, it's trying to modify and/or add/remove files from the htdocs and subsequent directories.

bulliver 01-10-2005 01:58 PM

Letting all users write to files in htdocs is terribly insecure, any user will be able to overwrite/erase any file!! Have you looked at using user dirs? Maybe if you explain what you are trying to do with more details I can help with a better solution here.

If you really want to do this, then change group permissions on the files +w and make sure users you want to do this are in 'users' group. They will need +x on the directories too...

ps who is cgoff? Your user?

technician 01-10-2005 02:22 PM

Yes, my user is cgoff. I currently have the dir permissions to 777 (I realize the potential here, the box is NOT online at the moment and I'm burned for time, so I just 777ed everything for FTP access).

Basically what I'm looking for is allowing an FTP user (just one user) to have complete access to adding/removing/editing files within the htdocs dir and subdirs. That is all :)

bulliver 01-10-2005 02:39 PM

Ok, then I suggest changing group permissions to this ftp user you want...you probably already have a group for ftp...check /etc/group, you may see something like:
Code:

ftp::21:
So add the user you want to ftp (i'll assume cgoff here) in /etc/group:
Code:

ftp::21:cgroff
Now cgroff is member of group 'ftp'. So now you need to chgrp all your htdocs:
Code:

# chgrp -R ftp /var/www/htdocs/
Now cgroff can edit/delete files in htdocs...

Note that 'ftp' is arbitrary, you can create a new group if you want....just follow same instructions to add your user to the group, and chgrp the files.

Edit:
sorry, you need to 'chmod -R g+w htdocs' as well.

technician 01-10-2005 02:47 PM

All right, thanks! I'll give that a shot and see what happens. :)


All times are GMT -5. The time now is 04:12 PM.