- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: setuid on directory
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
тАО08-21-2004 05:47 AM
тАО08-21-2004 05:47 AM
setuid on directory
I'm trying to setuid on a directory so any files created in there with have the ownership of the directory owner. So I used the chmod u+s command but it doesn't seem to work. Any ideas, the chmod g+s does work.
Thanks
Mike
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-21-2004 06:55 AM
тАО08-21-2004 06:55 AM
Re: setuid on directory
http://www.unixpeople.com/HOWTO/advanced.permissions.and.ACLs.html
Since the sticky bit had no implied meaning with respect to a directory,
it was decided to make its meaning thus:
When the sticky bit is set on a directory, the only people who can remove
files from that directory are:
1) root
2) the owner of the directory
3) the owner of the file to be removed
So, the permissions on the /tmp directory are actually:
drwxrwxrwt 7 sys sys 463 Aug 3 22:20 /tmp
The "t" represents the sticky bit.
{set the sticky bit on the directory "testing"}
$ chmod o+t testing
Can we set these bits using octal permissions?
Sure. Even though the "ls -l" output shows us 9 bits of permissions, the
inode actually stores 12 bits. Even though the display embeds the setuid,
setgid, and sticky bits within the same 9 characters, they are actually
the most significant bits of the permissions and as such, can be represented
by an additional octal digit when using chmod.
Example
-------
To set the permissions on the tmp directory.
# chmod 1777 /tmp
Hope this helps,
Robert-Jan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-21-2004 09:25 PM
тАО08-21-2004 09:25 PM
Re: setuid on directory
Thanks for your response, what I'm trying to achieve is to set setuid on the directory not the sticky bit. I would like any files created by any user to take the ownership of the directory our.
If the directory "test" is owned by user A and user B creates a file in the directory. The file should be then be owned by user A.
The command to achieve is
chmod u+s test
I've set the setgid so any files created in the test directory have the group ownership of user A group. This was achieved using
chmod g+s test
But the setuid doesn;t seem to have an effect.
I'll check out the link you sent me to see if that can shed any light on the issue.
Thanks
Mike
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-22-2004 07:41 PM
тАО08-22-2004 07:41 PM
Re: setuid on directory
Try this.
# chmod 4755 your_directory
Regards,
Robert-Jan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-22-2004 10:22 PM
тАО08-22-2004 10:22 PM
Re: setuid on directory
See the man page for 'creat(2)', which only refers to the effect of the setgid bit (this is on 11.11):
If the file exists, its length is truncated to 0, and its mode and
owner are unchanged. Otherwise, the file's owner ID is set to the
effective user ID of the process. If the set-group-ID bit of the
parent directory is set, the file's group ID is set to the group ID of
the parent directory. Otherwise, the file's group ID is set to the
process's effective group ID.
(Regarding the chmod command, 'chmod u+s' and 'chmod 4755' have the same effect on the setuid bit. It's the setuid bit itself that has no effect when a file is created.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-23-2004 01:45 AM
тАО08-23-2004 01:45 AM
Re: setuid on directory
thanks for your responses, maybe I misunderstood the use of setuid on directories. Maybe you can suggest a solution to my probelm. I would like to create a directory with write privledges to everybody but when they create files in the directory they are owned by myself. Any sugestions.
Thanks
Mike
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-23-2004 12:08 PM
тАО08-23-2004 12:08 PM
Re: setuid on directory
But I don't believe that there is a bit you can set to get files created in a directory to be owned by the directory's owner.
In other words if a user creates a file, he/she owns that file and there's no way (that I know of) to set it so that the owner of the directory in which the file resides owns the newly created file.
So, since you want to own the files that you create, you don't have to do anything, because that is the default behavior.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-23-2004 08:56 PM
тАО08-23-2004 08:56 PM
Re: setuid on directory
If it's an application that is creating the files when other people run it, then you could set the setuid bit on the program to do that (it's a little more complicated than just that, but that's the general idea).
The other option would be to run a background job or cron job that periodically changes the owner of the files in that directory to be you.
It partly depends on why you want the files to be owned by you, and how they are created, as to what might work.
Andrew
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-09-2007 07:34 AM
тАО05-09-2007 07:34 AM
Re: setuid on directory
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-09-2007 08:28 AM
тАО05-09-2007 08:28 AM
Re: setuid on directory
Try some tests and see.
I belive the set-gid bit is advisory, and not all applications may adhere to the advisory.
-erich