Operating System - HP-UX
1833611 Members
3637 Online
110062 Solutions
New Discussion

access permissions to modify but not delete

 
Fernando Acevedo
Frequent Advisor

access permissions to modify but not delete

Hi, I need to put the access permissions to some direcoties/files to allow modify but not delete, is that possible?

thanks!.
6 REPLIES 6
David Bellamy
Respected Contributor

Re: access permissions to modify but not delete

do a man on chacl, that should help
KapilRaj
Honored Contributor

Re: access permissions to modify but not delete

if the object ( file) is /home/kaps/testfile ,

chown root.sys /home/kaps
chmod 755 /home/kaps
chown kaps /home/kaps/testfile

Now user "kaps" can modify this file but can not delete.

Regds,

Kaps
Nothing is impossible
Bill Hassell
Honored Contributor

Re: access permissions to modify but not delete

There are two permissions for every file -- the read and write permissions (which belong to the file) and the creation and deletion permission for a file belongs to the directory. So the exitence of a file depends on the directory, not the file permissions. Remove write permission to the directory to prevent creation or removal of any files.


Bill Hassell, sysadmin
vinod_25
Valued Contributor

Re: access permissions to modify but not delete

Hi Fernando,

I feel sticky bit will be helpful in your case.

A 't' or 'T' as the last character of the "ls -l" mode characters indicates that the "sticky" (save text image) bit is set.

sticky bit on directories
=========================
[From chmod(2)]
If the mode bit S_ISVTX (sticky bit) is set on a directory, files inside the directory may be renamed or removed only by the owner of the file, the owner of the directory, or the superuser (even if the modes of the directory would otherwise allow such an operation).

Regds,
Vinod
Jan van den Ende
Honored Contributor

Re: access permissions to modify but not delete

Bill,

The way I read (interpreted?) Fernando's request, your answer

Remove write permission to the directory to prevent creation or removal of any files.

is doing MUCH more then desired: it ALSO blocks creation of NEW files. _I_ definitely did not read that in the question!

Being only little versed in *UX systems, but trying to leard (but from interest as from job requirement) I am curious how to achieve such (in my view trivial) requirement.

So, is there an *UX equivalent,or a way to construct the equivalence, of the VMS "D" or "delete" permit? (or maybe, which *UX has, and which has not)?

Actually, it is this question that again made me aware that some things I have "always" accepted as elementary should NOT be taken for granted when changing OS!
(and this applies both ways)

fwiw,

Proost.

Have one on me.

jpe
Don't rust yours pelled jacker to fine doll missed aches.
Bill Hassell
Honored Contributor

Re: access permissions to modify but not delete

Yes, my answer extended beyond the original requirement (create and delete) because that's the way it works in Unix (not just HP-UX). The concept is fairly simple: the directory is also a file, a file of names and inode numbers. To create a file, you have to write the new name into the directory. And to delete the file, you have to write to the directory to delete the filename.

VMS has a lot of unique features that other OS's do not have. The best way to approach a new OS (even if it is called 'Unix') is to check the man pages and also check the Rosetta Stone and also the Unix command cross references:

http://bhami.com/rosetta.html
http://www.math.utah.edu:8080/~beebe/unix/
http://unixguide.net/cgi-bin/unixguide.cgi
http://www.unixporting.com/quickguide.html


Bill Hassell, sysadmin