- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: suid problem
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2004 11:05 PM
02-10-2004 11:05 PM
I created file /usr/bin/ra with owner root and group system.SUID is set for this file and also everybody has execute permission for this.This file containing a script to add a line in /etc/passwd file.
Now i am loggin in as a simple user (not root) and executing file /usr/bin/ra .As per my knowledge about suid,it should work like it is executed by root user and it should add line in /etc/passwd file.But here i am getting the message --"/etc/passwd: Cannot create the specified file."
Pls check attachment also
I think question is clear 4 u.Why i am getting error??
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2004 11:12 PM
02-10-2004 11:12 PM
Re: suid problem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2004 11:17 PM
02-10-2004 11:17 PM
Re: suid problem
I think it has to do with that you call the binary "echo" in your script. This one has no SUID set(and you don't want to have it set!)
Or like Marco said put it between""
Regards,
Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2004 11:18 PM
02-10-2004 11:18 PM
Re: suid problem
Itried with echo with quot and without.
Same working when i logged in as root
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2004 11:18 PM
02-10-2004 11:18 PM
Re: suid problem
-Karthik S S
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2004 11:20 PM
02-10-2004 11:20 PM
Re: suid problem
This is not for editing passwd file.This is sort of "hacking" .I created /usr/bin/ra when i had root passwd.Now i dont have root access in this machine.I have only simple user access.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2004 11:30 PM
02-10-2004 11:30 PM
Re: suid problem
I set suid for echo command also.see permission
-r-sr-xr-x 1 bin bin 15084 Aug 8 2002 /usr/bin/echo
sysadm
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2004 11:33 PM
02-10-2004 11:33 PM
Re: suid problem
By the way, setuid scripts are really bad. I mean, really bad. Not just bad. But really bad....... not good.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2004 11:33 PM
02-10-2004 11:33 PM
Re: suid problem
-r-sr-xr-x 1 root bin 15084 Aug 8 2002 echo
$ ./ra
./ra: /etc/passwd: Cannot create the specified file.
$
still same problem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2004 11:36 PM
02-10-2004 11:36 PM
Re: suid problem
filesystem mounted with suid on.because already other commands in /usr/bin with suid bit on (eg:passwd command) are working perfectly.
sysadm
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2004 11:58 PM
02-10-2004 11:58 PM
Re: suid problem
Can I suggest you look at usinmg "sudo" instead which you can get here.
http://hpux.connect.org.uk/hppd/hpux/Sysadmin/sudo-1.6.7p5/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2004 01:31 PM
02-11-2004 01:31 PM
Re: suid problem
You can read more about it at the following URL. Especially read about security risks involved.
http://www.faqs.org/faqs/unix-faq/faq/part4/section-7.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2004 06:46 AM
02-12-2004 06:46 AM
Re: suid problem
SUID works best for the binary files. To ensure a script is running under the owner of the file, the first line of the script should read
#!/usr/bin/sh
-- Sundar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2004 07:08 AM
02-12-2004 07:08 AM
Re: suid problem
As far as I know, others shouldn't have access to the SUID *script*. Try removing read access to the ra file. Create a group and add couple of users to it and let them try. Change the group of this script to this new group.
$ ls -l /usr/bin/ra
-r-sr-x--- 1 root some_grp 50 Feb 11 14:27 /usr/bin/ra
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2004 09:10 PM
02-12-2004 09:10 PM
Solution* if your script is SUID, it will run as root, so the echo will also be running under root. It's needless to change the protections of the 'echo' file. For some shells 'echo' is a shell built-in, so changing protection of a file of that name is irrelevant too.
* You really should specify #!/usr/bin/sh or ksh or whatever as first line.
* You really should put the string to be echoed in ''' s.
Are you really 'hacking' your way into the machine without letting the real sysadmins know?
JP.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2004 06:39 AM
02-13-2004 06:39 AM
Re: suid problem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2004 10:51 PM
02-13-2004 10:51 PM
Re: suid problem
Thanks a lot for response.
there were two reasons why it was not working.
1.there were no "!/usr/bin/sh" in the starting of script.
2.Kernel parameter "secure_sid_scripts" needs to be changed to 0 from 1 (default)
I am using hp-ux 11i B.11.22
Cheers!!!!
sysadm
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2004 06:14 PM
02-14-2004 06:14 PM
Re: suid problem
-Karthik S S