- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Any commands or script can reverse the permission?
Operating System - HP-UX
1824149
Members
4484
Online
109668
Solutions
Forums
Categories
Company
Local Language
юдл
back
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
Forums
Discussions
юдл
back
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
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- 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-13-2003 12:37 AM
тАО03-13-2003 12:37 AM
Hi Experts,
I would like to know any commands or script can return the reverse value of the permission of the file or directory. ie, if the file had -rwxr-x---, it will return 750, -rwsr-x--- will return 4750 (Return sticky bit also)
Thanks in advance.
KennyC.
I would like to know any commands or script can return the reverse value of the permission of the file or directory. ie, if the file had -rwxr-x---, it will return 750, -rwsr-x--- will return 4750 (Return sticky bit also)
Thanks in advance.
KennyC.
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-13-2003 12:43 AM
тАО03-13-2003 12:43 AM
Solution
You may compile this little source:
#include
#include
int main (argc, argv)
int argc;
char ** argv;
{
struct stat buf;
if (stat(argv[1], &buf) != 0) {
perror ("stat failed");
exit (1);
}
printf ("%04o\n", buf.st_mode & 07777);
exit (0);
}
e.g.
save it as perm.c, then compile it using
# cc -o perm perm.c
# ./perm /etc/passwd
0444
Best regards...
Dietmar.
#include
#include
int main (argc, argv)
int argc;
char ** argv;
{
struct stat buf;
if (stat(argv[1], &buf) != 0) {
perror ("stat failed");
exit (1);
}
printf ("%04o\n", buf.st_mode & 07777);
exit (0);
}
e.g.
save it as perm.c, then compile it using
# cc -o perm perm.c
# ./perm /etc/passwd
0444
Best regards...
Dietmar.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-13-2003 12:43 AM
тАО03-13-2003 12:43 AM
Re: Any commands or script can reverse the permission?
a5:/tmp 108 > ls -l xx
-rwxr-xr-- 1 merijn softwr 0 Mar 13 09:40 xx
a5:/tmp 109 > perl -le'print+(stat)[2]for@ARGV' xx
33260
a5:/tmp 110 > perl -le'printf"0%o\n",(stat)[2]for@ARGV' xx
0100754
a5:/tmp 111 >
Enjoy, have FUN! H.Merijn
-rwxr-xr-- 1 merijn softwr 0 Mar 13 09:40 xx
a5:/tmp 109 > perl -le'print+(stat)[2]for@ARGV' xx
33260
a5:/tmp 110 > perl -le'printf"0%o\n",(stat)[2]for@ARGV' xx
0100754
a5:/tmp 111 >
Enjoy, have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-13-2003 12:56 AM
тАО03-13-2003 12:56 AM
Re: Any commands or script can reverse the permission?
Thanks for your help. It save me alot of times.
Thanks very much.
KennyC.
Thanks very much.
KennyC.
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Learn About
News and Events
Support
© Copyright 2025 Hewlett Packard Enterprise Development LP