LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 03-07-2005, 03:14 PM   #1
antony.booth
LQ Newbie
 
Registered: Oct 2004
Location: UK
Distribution: Fedora
Posts: 23

Rep: Reputation: 15
How to make a file inherit script permissions


Hello, I am wondering if I can set a binary file with user permissions set only (0700: - rwx --- ---), so it can only be executed directly by the owner, but I would like it to also be executed if run from a script by member of the group the file belongs to?

As you can see, the binary itself does not have any access rights for group, but is there a way the script can grant rights for the session? It could not actually set the permissions on the file as it would be used by several people, but the user rights for the file could be inherited from the script?

The reason I want to do this is to ensure the various setup and tidyup commands in the script are performed.

I thought that setting the script with SUID would work, but I get a permission denied error.

I thought about having a copy of the file moved to the users home directory, set the permissions, then execute, but it wouldn't work because the user could execute the binary from their directory, whilst the script is running in another shell session. Also, the file needs to be in a specific directory to execute properly.

Any help would be greatfully appreciated

OS: Linux RH ES
 
Old 03-08-2005, 04:21 PM   #2
enigmasoldier
Member
 
Registered: Jul 2003
Location: Florence, Ky
Distribution: CentOS 3.3-4, OpenBSD 3.3, Fedora Core 4, Ubuntu, Novell Open Enterprise Server
Posts: 213

Rep: Reputation: 30
bash is intelligent and won't let you set the suid bits on a script file. You might look into sudo if the script requires root access.
 
Old 03-08-2005, 05:18 PM   #3
Aeiri
Member
 
Registered: Feb 2004
Posts: 307

Rep: Reputation: 30
Re: How to make a file inherit script permissions

Just give the file permissions 750.
 
Old 03-11-2005, 05:03 AM   #4
antony.booth
LQ Newbie
 
Registered: Oct 2004
Location: UK
Distribution: Fedora
Posts: 23

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by enigmasoldier
bash is intelligent and won't let you set the suid bits on a script file. You might look into sudo if the script requires root access.
What I want is a script with group execute permissions to execute a binary without execute permissions. This way, only the script can execute the binary instead of users executing from the shell prompt.
Sudo sounds like it may be the answer though. I didn't really want to temporarily grant root access, but temporarily allowing the group the same permissions as root would work.

Thanks for the tip.

Last edited by antony.booth; 03-11-2005 at 05:08 AM.
 
Old 03-11-2005, 05:04 AM   #5
antony.booth
LQ Newbie
 
Registered: Oct 2004
Location: UK
Distribution: Fedora
Posts: 23

Original Poster
Rep: Reputation: 15
Re: Re: How to make a file inherit script permissions

Quote:
Originally posted by Aeiri
Just give the file permissions 750.
By doing that, I am enabling group members the ability to execute the binary directly from the shell prompt, which is exactly what I'm trying to prevent.
 
  


Reply



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
Perl cgi Script can`t make file.Why? ZairSadiqov Linux - Software 1 11-22-2006 07:22 AM
Samba Won't Inherit Permissions blackrain69 Linux - Software 1 10-13-2004 01:46 AM
check file permissions in a script cambie Linux - General 9 09-22-2004 12:13 AM
How to Make a Linux Script File TankerKevo Linux - Newbie 3 06-18-2004 07:39 PM
Inherit Permissions in Samba mslane Linux - Software 1 10-09-2003 05:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 07:08 AM.

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