Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here. |
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
 |
10-22-2004, 01:56 PM
|
#1
|
Member
Registered: Aug 2003
Distribution: windows xp home, windows 98, red hat 9, fedora core 3, redhat enterprise linux, win2000 pro/server
Posts: 217
Rep:
|
permissions for directory tree
hello, i am running some software that will create files at random times (like log files and such) into one directory in htdocs/
the program (run as root on startup) can write the files just fine, but then as nobody (the user apache runs as) a CGI script cannot write to and/or delete these files
easy response #1: run program as nobody, cannot be done becuase that opens up security holes with being able to login to a bash shell with nobody, which is a system account
easy response #2: set SGID on htdocs/ directory, cannot be done because then the default umask is 022, which A: will not allow anyone in the group to write to it and B: it makes new directories under htdocs/, which will not inherit the group owner from htdocs/
easy response #3: change default umask for machine, security risk
easy response #4: set a cron job to chmod 777 htdocs -R, doing that currently, but there has to be a cleaner way to do it
thanks for your help
--adam
|
|
|
10-22-2004, 02:46 PM
|
#2
|
Senior Member
Registered: Aug 2004
Location: England
Distribution: Ubuntu
Posts: 1,039
Rep:
|
What are the original permissions of the files you want to edit/delete?
What is the user / group owning the files to be modified?
What language are you using for your CGI scripts? (perl?)
Permissions of 777 on contents of htdocs (or any other area) is not a good idea!
|
|
|
10-22-2004, 09:05 PM
|
#3
|
Member
Registered: Aug 2003
Distribution: windows xp home, windows 98, red hat 9, fedora core 3, redhat enterprise linux, win2000 pro/server
Posts: 217
Original Poster
Rep:
|
the original permissions are 644 and are owned by root by default
the cgi script is a bash script, i guess is the programming language used in it
i know permissions of 777 is a bad idea, but my options were quite limited at the time, thats why im asking the question in the first place
thanks for your help
--adam
|
|
|
10-23-2004, 07:39 AM
|
#4
|
Senior Member
Registered: Aug 2004
Location: England
Distribution: Ubuntu
Posts: 1,039
Rep:
|
Check your /etc/passwd and /etc/group files for "apache"
If this account doesn't exist, create it
(as root)
groupadd apache
useradd -g apache -c "Account for Apache" apache
Edit your httpd.conf and change the lines for User and Group to:
User apache
Group apache
Change ownership of the htdocs files to apache:apache
Restart httpd
apachectl restart
Run the program which creates the files as the new user
|
|
|
All times are GMT -5. The time now is 01:31 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|