Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
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.
|
 |
03-21-2006, 05:05 PM
|
#1
|
Member
Registered: Feb 2004
Location: Chaska, MN
Distribution: Fedora
Posts: 195
Rep:
|
Link Rights
Is it possible to make a link to a file and give it different rights than the original file? Really all that I wanna do is let another user get read access to a file, when the file owner/group must stay at root:root, and the rights at nothing for others...
Thanks,
Scott K Logan
CottsayNet
logans@cottsay.net
|
|
|
03-21-2006, 05:34 PM
|
#2
|
Senior Member
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141
Rep: 
|
Not as far as I know. The name of the file is just a pointer to its contents. If you create a hard link and change its permissions the file gets the updated permissions. Therefore, each link shows the updated permissions.
If you create a symlink, the permissions of the symlink are ignored and the permissions on the actual file are used.
|
|
|
03-21-2006, 06:45 PM
|
#3
|
Senior Member
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,820
|
I think to do what you want you will need access control lists. Otherwise you would have to make a new group with read access and add that user to it.
|
|
|
03-21-2006, 08:04 PM
|
#4
|
Member
Registered: Jun 2004
Location: High Green
Distribution: Fedora Core 4
Posts: 180
Rep:
|
One way is to use sudo, if you only need to read or write using a specific program.
Putting the following into /etc/sudoers would allow reading fstab using less:
joeschmoe ALL = NOPASSWD: /usr/bin/less /etc/fstab
User joeschmoe would type sudo less /etc/fstab to read it with full root privileges. You could use this to allow copying a file, for example. Admittedly, sudoing is a bit hackish way of doing access control.
Simon
|
|
|
03-23-2006, 02:43 PM
|
#5
|
Member
Registered: Feb 2004
Location: Chaska, MN
Distribution: Fedora
Posts: 195
Original Poster
Rep:
|
Alright, great. Thanks. Is there a way to allow PHP to access fstab using its apache:apache rights but keeping root:root rights on fstab?
Thanks
Scott
|
|
|
03-23-2006, 03:28 PM
|
#6
|
Senior Member
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141
Rep: 
|
I have the following permissions on my fstab file, which are enough for the apache user to read the file:
Code:
$ ls -l /etc/fstab
-rw-r--r-- 1 root root 814 2006-02-14 12:45 /etc/fstab
Read rights are all an application should need and those are given by the 'o' as in 'ugo' of the 3 permission groups. What did you need to do to the fstab file?
|
|
|
03-23-2006, 03:50 PM
|
#7
|
Member
Registered: Feb 2004
Location: Chaska, MN
Distribution: Fedora
Posts: 195
Original Poster
Rep:
|
how about write to it?
|
|
|
03-23-2006, 04:41 PM
|
#8
|
Member
Registered: Feb 2005
Distribution: Ubuntu, Debian
Posts: 56
Rep:
|
Hmmm.. Might not be wise to allow access to apache... You could chmod it (ie: chmod a+rw /etc/fstab) to allow anyone to write to it, or you could create another group called admin, for example, and add the user www-data to it (the default Apache username), then do "chmod g+rw /etc/fstab"
Cheers,
Aaron
PS: Still, be careful. Any buggy or unchecked forms in your PHP code could allow an exploit. Why do you want to write to the fstab from PHP anyway??
|
|
|
03-23-2006, 05:31 PM
|
#9
|
Member
Registered: Feb 2004
Location: Chaska, MN
Distribution: Fedora
Posts: 195
Original Poster
Rep:
|
not fstab specifically - thats just the example used earlier in the thread. There must be a way to do this...right now i'm stuck with a ssh command with rsa keys to root and I don't like that. I just want to create a way to have a file:
-rwxrwx--- root:root /this_file
accessable to apache:apache without changing the rights at all...is there any way?
Thanks much!
|
|
|
03-23-2006, 09:25 PM
|
#10
|
Member
Registered: Feb 2005
Distribution: Ubuntu, Debian
Posts: 56
Rep:
|
You could add the user www-data to the root group. Then do:
Code:
cd /whatever/folder/
chmod -R 770 ./
Cheers,
Aaron
|
|
|
03-25-2006, 12:27 AM
|
#11
|
Member
Registered: Feb 2004
Location: Chaska, MN
Distribution: Fedora
Posts: 195
Original Poster
Rep:
|
It doesn't work like that...you configure user rights and group rights in the httpd.conf file...reguardless of the user's primary group. I was trying to avoid giving Apache root group rights...I think that the sudo thing is going to work fine though...thanks everyone!
Scott K Logan
CottsayNet
logans@cottsay.net
|
|
|
All times are GMT -5. The time now is 01:17 PM.
|
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
|
|