- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: setuid to run as root
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
Discussions
Discussions
Discussions
Forums
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
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
тАО11-03-2004 07:46 PM
тАО11-03-2004 07:46 PM
I need to create a shell script to list file owned by certain retired users and chown them for certain audit requirement. This script need to be run as root because I need to find in all avail filesystems.
I was told to use 'setuid' to run as root, but didn't get the right result even after setting the file permission to 4755.
Pls. advise on the correct way to set this up. Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-03-2004 07:51 PM
тАО11-03-2004 07:51 PM
Re: setuid to run as root
Try without 'read' permissions for others. 'chmod 4511 file'. It's not a good idea to keep suid files around. Having suid files is one of the major security threats. Create a group with all the required users, change the group ownership of that file to the group and give only execute permission 'chmod 4510 file' to make little safer.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-03-2004 08:07 PM
тАО11-03-2004 08:07 PM
Re: setuid to run as root
A better way is to write a little wrapper. Write a little C program wich does a "system('your shell script')". Compile and set mod to 4555. This will do the trick.
Regards,
Fred
"Reality is just a point of view." (P. K. D.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-03-2004 08:09 PM
тАО11-03-2004 08:09 PM
Re: setuid to run as root
As mentionned this is a security breach, install sudo:
http://hpux.connect.org.uk/hppd/hpux/Sysadmin/sudo-1.6.7p5/
And configure so that the user executes the script as root.
the syntax would then be sudo (or sudo -u root...)
All the best
Victor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-04-2004 03:54 AM
тАО11-04-2004 03:54 AM
Solution"chmod 4511" works well. But you need to ensure is that the script should have comment interpreter (for ex., #!/usr/bin/ksh). For ex.,
#cat sri.sh
/usr/sbin/ioscan -fnC tape
$ll sri.sh
-r-s--x--x 1 root sys 17 Nov 4 10:49 sri.sh
$./sri.sh
ksh: ./sri.sh: cannot open
#vi sri.sh
#cat sri.sh
#!/usr/bin/ksh
/usr/sbin/ioscan -fnC tape
$./sri.sh
Class I H/W Path Driver S/W State H/W Type Description
=====================================================================
tape 0 0/0/1/0.3.0 stape CLAIMED DEVICE HP C1537A
/dev/rmt/0m /dev/rmt/c0t3d0BESTn
/dev/rmt/0mb ....
Still, I wouldn't suggest you use setuid scripts/programs. For only one script, even sudo may not be required. YOu can setup customized and restricted SAM for it.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-04-2004 04:08 AM
тАО11-04-2004 04:08 AM
Re: setuid to run as root
I learned Linux before Unix, and on a Linux box :
$ ll frutst.sh
-r-s--x--x 1 root root 21 nov 4 18:06 frutst.sh
$ cat frutst.sh
cat: frutst.sh: Permission non accord├Г┬йe
$ /frutst.sh
/frutst.sh: /frutst.sh: Permission non accord├Г┬йe
$ su -
Password:
# cat /frutst.sh
#!/bin/sh
ls /root
Regards,
F
"Reality is just a point of view." (P. K. D.)