LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-10-2005, 01:49 PM   #1
technician
Member
 
Registered: Jul 2003
Location: Wisconsin
Distribution: Slackware 10
Posts: 50

Rep: Reputation: 15
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?
 
Old 01-10-2005, 02:21 PM   #2
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 78
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)
 
Old 01-10-2005, 02:48 PM   #3
technician
Member
 
Registered: Jul 2003
Location: Wisconsin
Distribution: Slackware 10
Posts: 50

Original Poster
Rep: Reputation: 15
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.

Last edited by technician; 01-10-2005 at 02:50 PM.
 
Old 01-10-2005, 02:58 PM   #4
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 78
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?
 
Old 01-10-2005, 03:22 PM   #5
technician
Member
 
Registered: Jul 2003
Location: Wisconsin
Distribution: Slackware 10
Posts: 50

Original Poster
Rep: Reputation: 15
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
 
Old 01-10-2005, 03:39 PM   #6
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 78
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.

Last edited by bulliver; 01-10-2005 at 03:40 PM.
 
Old 01-10-2005, 03:47 PM   #7
technician
Member
 
Registered: Jul 2003
Location: Wisconsin
Distribution: Slackware 10
Posts: 50

Original Poster
Rep: Reputation: 15
All right, thanks! I'll give that a shot and see what happens.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
FileZilla FTP to htdocs errors writ3r Linux - Newbie 2 07-02-2005 07:35 PM
white box: where is htdocs? rvc13 Linux - Newbie 1 02-12-2005 08:24 AM
apache looking for documentroot in /usr/htdocs niehls Linux - Software 3 07-06-2003 06:39 PM
Where is the htdocs folder for Apache? Ekim Gram Linux - Newbie 5 05-24-2003 08:16 AM
Apache HTDOCS help needed plz RecoilUK Linux - General 7 07-16-2001 02:51 PM


All times are GMT -5. The time now is 06:45 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration