[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

SUID issue

Posted on 2009-05-13
8
Medium Priority
?
262 Views
Last Modified: 2013-12-16
Hi,
i am trying to understand a basic about SUID
i want to run a script to copy file to a directory which owned by root
files will be copied from directory one to myroot directory.
permission of my root is as follows :
[root@/]# ls -l  | grep myroot
drwxr-xr-x   2 root   root    4096 May 13 12:51 myroot
the script permission is as follows :
[root@ /]# ls -l copy.sh
-rwsrwxrwx 1 root root 30 May 13 12:51 copy.sh
so i have sent suid to root, chmod u+s copy.sh
now i am trying to run this script as normal user, but its unable to copy file in myroot directory as its saying permission denyed

but as a rule, if i set suid , so the script should run as Root previliges, then why still its unable to copy ??
0
Comment
Question by:yusuf01
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 24373831
Hi,
the Linux kernel will not honour the setuid bit on shell scripts, as this could be a  major security issue!
setuid is only honoured with binaries.
wmp
0
 

Author Comment

by:yusuf01
ID: 24373860
HI,

by binaries you meant, programm such as sendmail or user defined program written by C or something like that??

then what about thsi article
http://lokams.blogspot.com/2008/03/about-suid-sgid-and-sticky-bit.html
http://www.codecoffee.com/tipsforlinux/articles/028.html

every where its saying "shell script"
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 24374048
With 'binaries' I mean compiled code. Sorry for not having been clear enough.
OK, it seems that I am right, since your script doesn't run as expected, does it?
Maybe there are Unix'es around which allow setuid for scripts, but I am not aware of any.
You could circumvent your problem either by using 'sudo' to start the script or by writing a small wrapper in C around the script employing 'popen' or 'execl' or 'system'.
wmp
 
 
 
 
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:yusuf01
ID: 24374114
you could be right, i just read for mandrive , it does not support script to use suid...

but its wired , every example in web for suid is showing for script, i never seen any site is saying that suid does not support sciprt ....

0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 24374157
0
 

Author Comment

by:yusuf01
ID: 24374179
thanks
let me come back from launch, then will read that link
0
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 540 total points
ID: 24374480
The link above is a bit misleading. The article mainly deals with a 'what if ...' scenario (what if setuid was possible with shell scripts).
Here is another, maybe better thingy -
http://rob.sun3.org/misc/setgid-and-setuid-shell-scripts/
 
0
 

Author Comment

by:yusuf01
ID: 24374973
yes the 2nd link is realy good
thanks to share information with me.
i will close this question now
0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question