- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: running "chown" within a SETUID script
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
05-06-2003 05:26 PM
05-06-2003 05:26 PM
1) i set the script permissions to 4555
2) CHOWN is set globally
i know about sudo and the fact that i can run this script as a root cronjob ...just wanting to know why chown does not work within a SETUID script
is the command "chown" not fooled by the SETUID bit?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2003 05:42 PM
05-06-2003 05:42 PM
Re: running "chown" within a SETUID script
Using the CHOWN privilege just allows a user to 'chown' files that belong to them. Everyone gets that by default. It sounds like your set-uid script is running as root but doesn't have the effective user ID set for root, which is what the chown call is looking for.
From the chown (2) man page:
Only processes with an effective user ID equal to the file owner or a user having appropriate privileges can change the ownership of a file. If privilege groups are supported, the owner of a file can change the ownership only as a member of a privilege group allowing CHOWN, as set up by the setprivgrp command (see setprivgrp(1M) ). All users get the CHOWN privilege by default.
You could try running the 'id' command inside of your script to see if it will report what the effective user ID is while it is running.
JP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2003 07:37 PM
05-06-2003 07:37 PM
Re: running "chown" within a SETUID script
1- whoami
2- who am i
1 returns "root" as the effective uid and 2 returns "skchan". What does yours return ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2003 03:59 AM
05-07-2003 03:59 AM
SolutionYou say that "all works except the chown...". First, I agree with John and SK, if you add the 'id' command, does your script show that it has an effective uid of zero?
Make sure that you have specified the shell interpreter "she-bang":
#!/usr/bin/sh
...or...
#!/sbin/sh
Without this the script will not run as an suid script despite the permissions denoting this state.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2003 04:02 AM
05-07-2003 04:02 AM
Re: running "chown" within a SETUID script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2003 09:38 AM
05-07-2003 09:38 AM
Re: running "chown" within a SETUID script
SK: thx for confirming that it should work ...i learned that "whoami" and "id" always return the real user name while "who am i" returns root as the user name
James: thx for the fix! i did not define the shell in the script ...awesome catch
Frank: can i make the SETUID script somewhat secure by setting the permissions to 4550. my thought is that if a hacker has the ability to modify this script then the hacker has the ability to do worse anyways....
FYI: below is the actual script ...James gave the fix in that i did not have this 1st line defining the shell
#!/bin/sh
cd /opt/tomcat/webapps/IDCNServlets/xml
chown webadmin:webgroup *.xml
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2003 10:02 PM
05-07-2003 10:02 PM
Re: running "chown" within a SETUID script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2003 09:29 AM
05-08-2003 09:29 AM
Re: running "chown" within a SETUID script
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
05-08-2003 09:43 AM
05-08-2003 09:43 AM
Re: running "chown" within a SETUID script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2003 11:50 AM
05-08-2003 11:50 AM