- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- what is difference betweem mode 4555 and 555
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
тАО03-23-2004 06:26 AM
тАО03-23-2004 06:26 AM
This is not what I want, so I am think change the permission of the script to "555". Is there any differences between these two permissions? and Should I do this change?
thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-23-2004 06:32 AM
тАО03-23-2004 06:32 AM
Re: what is difference betweem mode 4555 and 555
Man 2 chmod for details.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-23-2004 06:32 AM
тАО03-23-2004 06:32 AM
Re: what is difference betweem mode 4555 and 555
from the man pages of chmod:
4000 (= u=s) Set user ID on file execution (file only)
meaning 4555 runs the programme as owner, in your case root.
greetings,
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-23-2004 06:33 AM
тАО03-23-2004 06:33 AM
SolutionMode 4555 means set uid - which means the process will take the previleges of the owner of the executable irrespective of who creates the process. There is something called Effective UID and real UID. In this case real UID is the user who executes the script and effective UID is the owner of the script which is root in this case.
/usr/bin/passwd is the classical example of SUID binary in the system which allows normal users to change the password in /etc/passwd (or /tcb/files/auth/x/XXX) which is usually r--r--r--
you have other modes too 2xxx and 1xxxx
2xxx = set GID
1xxx = sticky bit.
- Sundar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-23-2004 06:41 AM
тАО03-23-2004 06:41 AM
Re: what is difference betweem mode 4555 and 555
How do I get the real user id in the script, the id who execute the script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-23-2004 07:07 AM
тАО03-23-2004 07:07 AM
Re: what is difference betweem mode 4555 and 555
whoami is fine.
greetings,
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-23-2004 07:13 AM
тАО03-23-2004 07:13 AM
Re: what is difference betweem mode 4555 and 555
who am i
instead of whoami
MYUSER=`/usr/bin/who am i|awk '{ print $1}'`
echo "hello $MYUSER"
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-23-2004 07:39 AM
тАО03-23-2004 07:39 AM
Re: what is difference betweem mode 4555 and 555
U did not get what I am asking
if I have set the permission to be 4555 on my script xyz, then the result of whoami will be "root", no matter who is actually running it.
So, my quetion is how to get the uid in the script xyz, and the id is the one who I running the script, not the "root".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-23-2004 07:48 AM
тАО03-23-2004 07:48 AM
Re: what is difference betweem mode 4555 and 555
Note the spaces in the command 'who am i'. There is a difference between 'whoami' and 'who am i'.
I just ran a quick test on a script with 4555 permissions and root as the owner.
Here is the script:
# ll test
-r-sr-xr-x 1 root sys 108 Mar 23 14:45 test*
# cat test
#!/usr/bin/sh
WHOAMI=$(whoami)
echo "whoami = ${WHOAMI}"
WHO_AM_I=$(who am i)
echo "who am i = ${WHO_AM_I}"
Here is the output when run as user wallekp:
$ ./test
whoami = root
who am i = wallekp pts/39 Mar 23 14:43
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-23-2004 07:50 AM
тАО03-23-2004 07:50 AM
Re: what is difference betweem mode 4555 and 555
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-23-2004 08:18 AM
тАО03-23-2004 08:18 AM
Re: what is difference betweem mode 4555 and 555
You can use an alternate method as well
Within the script
UNIX95= ps -p $$ -o uid,ruid | grep -v UID | read EF REAL
EF holds the effective user ID
RUID - Real user ID
Thanks,
Sundar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-24-2004 06:47 AM
тАО03-24-2004 06:47 AM
Re: what is difference betweem mode 4555 and 555
Setuid scripts are very dangerous. Most shells can be coerced to run whatever you want by setting environment variables that affect their behavior. A setuid script is an invitation to hack it.