473,507 Members | 8,022 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

setuid program

I find I can't run setuid perl script
when I do this on a Unix-like platform:

1.Create a file "setuid.pl":
#!/usr/bin/perl -T
2.chmod a+x setuid.pl
3.chmod u+s setuid.pl

then i try

shell> ./setuid.pl
Permission denied.

hmm...it always come out with this,
and it's not because i don't have execute permission.
The message was sent by perl,
can anyone tell me how should I write a setuid program in perl?
Without a external wrap on it.
Thank you very much.
Jul 19 '05 #1
3 9278
> The message was sent by perl,
can anyone tell me how should I write a setuid program in perl?


Is it maybe that the perl interpreter is not running as root? What are the
exact permissions on the perl script? I would imagine (but haven't verified)
that if the current user has permission to execute the script, that it will
load as that user, and not as root. Perhaps if the permissions are 700 on
the perl script it might force the execution as root.

Just a thought

Dale
Jul 19 '05 #2
Dale Atkin <ne*******@greensquare.ca> wrote:
The message was sent by perl,
can anyone tell me how should I write a setuid program in perl?

Is it maybe that the perl interpreter is not running as root? What are the
exact permissions on the perl script? I would imagine (but haven't verified)
that if the current user has permission to execute the script, that it will
load as that user, and not as root. Perhaps if the permissions are 700 on
the perl script it might force the execution as root.
Just a thought
Dale

-rwsr-xr-x 1 wchunhao cp 19 Oct 8 00:04 setuid.pl*
I want the program to be run by other people,
and he can be setuid to my uid.
I don't think the owner have to be root since I don't want it to setuid
to root, just setuid to my uid.

How to make it? thank u.
Jul 19 '05 #3

"pasear" <wc******@csie.nctu.edu.tw> wrote in message
news:bl**********@netnews2.csie.nctu.edu.tw...
I find I can't run setuid perl script
when I do this on a Unix-like platform:

1.Create a file "setuid.pl":
#!/usr/bin/perl -T
2.chmod a+x setuid.pl
3.chmod u+s setuid.pl

then i try

shell> ./setuid.pl
Permission denied.

hmm...it always come out with this,
and it's not because i don't have execute permission.
The message was sent by perl,
can anyone tell me how should I write a setuid program in perl?
Without a external wrap on it.
Thank you very much.


Setuid scripts are very dangerous. I didn't think the operating system even
honored the setuid bit for scripts. Am I mistaken ? Perl gave me loads of
headaches even when I tried to convert the perl script to a binary file
using perl2exe. Even after 'untainting' all of the variables, there were
still many problems. I ended up having to re-write the program in C, which
also happens to be the safest way to run a program as setuid.
Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
4902
by: Ben Eisenberg | last post by:
I'm trying to run a php script setuid. I've tried POSIX_setuid but you have to be root to run this. The files are located on a public access unix system and have me as the owner and nobody as the...
0
1492
by: Dave Harrison | last post by:
hi again, Im clearly a moron, and have solved the problem myself, due to a wish to avoid dire embarrasment I shall not reveal the stupid mistake I made ;-) Apologies for the inconvenience...
1
2578
by: Domenico Andreoli | last post by:
Hi, I did a little research about execution of Python setuid scripts. I found only a couple of C wrappers I don't like. So I wrote my own, it is available at . Feel free to send comments. 2c...
3
8367
by: Michele Simionato | last post by:
I have a script that sometimes is run by myself (user id 501) and sometimes by the mailer program as nobody/nogroup (userid 65534). I would like to change the effective uid to 501 in any case, to...
2
3067
by: Rajesh | last post by:
Can someone provide me a sample C program to set the uid? The requirement is the batch id 'abatchid' should be the one who can copy a file from foldera to folderb. But the user who does not have...
1
2756
by: vimala | last post by:
Hi, I have to write a setuid program which is going to check for accesslogs based on the real user who had invoked the executable. I need to get the real and effective user-ids of the system...
3
3756
by: Tiago Simões Batista | last post by:
Hello all I have a situation that requires that a python script, that is run from a webpage (via php exec()) must be run with root privileges. The sysadmin already set the setuid bit on the...
2
2519
by: Stu | last post by:
Is there anyway to tell if a setuid() call has been made to some other user? If so, can somebody provide me with some sample code Thanks in advance to all that answer
6
3615
by: thirusvga | last post by:
please help me... Hi i want to run a php program using linux command.... php program is stored in /var/www/html/t.php that program is <?php $command='ooffice -invisible...
0
7105
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7308
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7371
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7023
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7479
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5037
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3188
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3178
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
410
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.