LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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


Reply
  Search this Thread
Old 03-21-2006, 05:05 PM   #1
Cottsay
Member
 
Registered: Feb 2004
Location: Chaska, MN
Distribution: Fedora
Posts: 195

Rep: Reputation: 31
Question 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
 
Old 03-21-2006, 05:34 PM   #2
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
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.
 
Old 03-21-2006, 06:45 PM   #3
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,820

Rep: Reputation: 2103Reputation: 2103Reputation: 2103Reputation: 2103Reputation: 2103Reputation: 2103Reputation: 2103Reputation: 2103Reputation: 2103Reputation: 2103Reputation: 2103
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.
 
Old 03-21-2006, 08:04 PM   #4
wipe
Member
 
Registered: Jun 2004
Location: High Green
Distribution: Fedora Core 4
Posts: 180

Rep: Reputation: 30
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
 
Old 03-23-2006, 02:43 PM   #5
Cottsay
Member
 
Registered: Feb 2004
Location: Chaska, MN
Distribution: Fedora
Posts: 195

Original Poster
Rep: Reputation: 31
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
 
Old 03-23-2006, 03:28 PM   #6
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
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?
 
Old 03-23-2006, 03:50 PM   #7
Cottsay
Member
 
Registered: Feb 2004
Location: Chaska, MN
Distribution: Fedora
Posts: 195

Original Poster
Rep: Reputation: 31
how about write to it?
 
Old 03-23-2006, 04:41 PM   #8
nevelis
Member
 
Registered: Feb 2005
Distribution: Ubuntu, Debian
Posts: 56

Rep: Reputation: 15
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??
 
Old 03-23-2006, 05:31 PM   #9
Cottsay
Member
 
Registered: Feb 2004
Location: Chaska, MN
Distribution: Fedora
Posts: 195

Original Poster
Rep: Reputation: 31
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!
 
Old 03-23-2006, 09:25 PM   #10
nevelis
Member
 
Registered: Feb 2005
Distribution: Ubuntu, Debian
Posts: 56

Rep: Reputation: 15
You could add the user www-data to the root group. Then do:

Code:
cd /whatever/folder/
chmod -R 770 ./
Cheers,
Aaron
 
Old 03-25-2006, 12:27 AM   #11
Cottsay
Member
 
Registered: Feb 2004
Location: Chaska, MN
Distribution: Fedora
Posts: 195

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


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
Difference Between Soft Link & Hard Link rajaniyer123 Solaris / OpenSolaris 16 09-30-2012 03:42 AM
Broadcom BCM4401 NIC: Link is Down, Link is up mr.wobble Linux - Hardware 6 08-31-2007 10:48 AM
OpenBSD 3.6 install D-Link 300T / D-Link DFE 528TX lesleyb *BSD 2 04-01-2005 06:29 PM
Wake on Lan - Link on b4 power up, No Link light after shutdown? Mark007 Linux - Networking 0 11-20-2004 08:16 PM
eth1... failed; no link present. Check Link? illegalien Linux - Networking 3 11-03-2002 10:46 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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