How UNIX admin set up this? how files of 744 of other owner can be removed by another owner?

Hi all,

We have some files are under 744 permissions and the the owner is say owner1 and group1.
Now we have another user owner2 of group2, owner2 can remove files of the owner1 and the permission of those files are 744, unix admin told us he did some config at his side so we can do that.

So I just wondering how this can be setup? Note that both owner1 and owner2 also belong to other groups and possibly owner1 in group2 and owner2 in group1 also...but files under 744 can be deleted is what I don't know how that happened ?

thanks,
thegunman.

I may be talking out of school here, but would'nt setuid allow this?

Is the directory other write? ie., xx7

Also, and I don't know much about ACL's (so I won't go there), but would't directory permissions also have a part to play?

That's usually done by the filesystem ACL mechanism.

You can see if ACL support is enabled on the filesystem by looking for the 'acl' option in the output of the 'mount' command (linux).

Try running 'getacl' or 'getfacl' on the directories/files. This tells you what other groups or users have write access (also delete)

Hope this helps

Thanks for all the replies !!
I guess ceubank gave the answer...

but looks like getacl or getfacl are not available on AIX 5.3.
So basically that means, what we see in the file permission bits that we deal with everyday, may not be what we think, the unix admin could do something there and over write the user permission settings.

This is what happened, it took me quite some time to remove the company confidential information from the screen cuts below:

f8fm: /apps/z0/log/new2/Jr>ls -l *12-1*
-rw-r--r--    1 wasadmin wasgrp     31796647 Dec 17 23:59 Jr.log.2009-12-17.#d0005
-rw-r--r--    1 wasadmin wasgrp     14488275 Dec 18 23:59 Jr.log.2009-12-18.#d0005
-rw-r--r--    1 wasadmin wasgrp     31624695 Dec 19 23:59 Jr.log.2009-12-19.#d0005
f8fm: /apps/zwl0/log/new2/Jr>
f8fm: /apps/z0/log/new2/Jr>lsuser f8fm
f8fm id=143313146 pgrp=uxzwl0p groups=uxzwl0p home=/users/f8fm shell=/usr/bin/ksh gecos=Phang Contractor registry=compat roles=
f8fm: /apps/z0/log/new2/Jr>lsuser wasadmin
wasadmin id=6047 pgrp=wasgrp groups=wasgrp,suroot,appidgrp,uxzwl0p home=/home/wasadmin shell=/usr/bin/ksh gecos=Websphere admin ID, IS#060733
f8fm: /apps/z0/log/new2/Jr>

f8fm: /apps/z0/log/new2/Jr>rm Jr.log.2009-12-17.#d0005
rm: Remove Jr.log.2009-12-17.#d0005? y
f8fm: /apps/z0/log/new2/Jr>ls -l *12-1*
-rw-r--r--    1 wasadmin wasgrp     14488275 Dec 18 23:59 Jr.log.2009-12-18.#d0005
-rw-r--r--    1 wasadmin wasgrp     31624695 Dec 19 23:59 Jr.log.2009-12-19.#d0005
f8fm: /apps/z0/log/new2/Jr>

f8fm: /apps/z0/log/new2/Jr>df .
Filesystem    512-blocks      Free %Used    Iused %Iused Mounted on
/dev/lvappz0log  104857600 103082760    2%      139     1% /apps/z0/log
f8fmil: /apps/z0/log/new2/Jr>mount -o acl
  node       mounted        mounted over    vfs       date        options      
-------- ---------------  ---------------  ------ ------------ --------------- 
         /dev/hd4         /                jfs2   Nov 18 15:52 rw,log=/dev/hd8 
         /dev/hd2         /usr             jfs2   Nov 18 15:52 rw,log=/dev/hd8 
        /dev/lvappz0log /apps/z0/log   jfs2   Nov 18 15:53 rw,log=/dev/lg_appvg01
f8fm: /apps/z0/log/new2/Jr>getacl
ksh: getacl:  not found.
Ph: /apps/z0/log/new2/Jr>getfacl
ksh: getfacl:  not found.
f8fm: /apps/z0/log/new2/Jr>

ACLs can overwrite POSIX if that is what you are asking. Sometimes if your servers are running any kind of directory services and LDAP they will put ACLs in the file system by default, and they will be set by default as what the default settings will most likely be.

I have seen this in OS X and in SuSe Linux, but anything outside of those two I don't have much experience with ACLs.

I wasn't asking anything, actually, but thank you for the clarification :slight_smile:

ACLs can be a pain, especially when used with nested folders, but when they work they are a great. I did notice that on the newest version of OS X (which I know is it's own version of Unix) has some custom default ACLs "everyone:deny" on certain folders in every user's home directory, by default.

Hi ceubank, would you please be able to explain what does this means interms of the last options colomn? Does rw means that the current user who issue this mount command has rw access to the file system(/apps/z0/log) even the files in there belong to someone else and permissions are say 700 ?

Thanks in advance.

f8fmil: /apps/z0/log/new2/Jr>mount -o acl
  node       mounted        mounted over    vfs       date        options      
-------- ---------------  ---------------  ------ ------------ --------------- 
         /dev/hd4         /                jfs2   Nov 18 15:52 rw,log=/dev/hd8 
         /dev/hd2         /usr             jfs2   Nov 18 15:52 rw,log=/dev/hd8 
        /dev/lvappz0log /apps/z0/log   jfs2   Nov 18 15:53 rw,log=/dev/lg_appvg01

No, it just means the filesystem is mounted as read-write, letting people read and write according to their normal permissions, as opposed to read-only.

Without ACL's, directory permissions are the only thing describing who can and can't delete files. File permissions and ownership are irrelevant. Observe:

$ mkdir tmp
$ touch tmp/notouch
$ chmod 000 tmp/notouch
$ sudo chown root:root tmp/notouch
# You can delete a root-owned file with 000 permissions, if it's in your dir!
$ rm tmp/notouch

---------- Post updated at 10:07 AM ---------- Previous update was at 09:49 AM ----------

I had to do some testing to figure it out, but the sticky bit could help do what you want. It's also known as the restricted-deletion bit. On supported systems&filesystems, inside a directory with it set(with chmod +t), users cannot rename or remove files that don't belong to them. It's often used for /tmp.

(Note that this protection is short-circuited if the user in question actually owns the directory. Have it owned by root or something.)

Using ACLs, you chould just do:

chmod +a "others allow delete" filename

to allow others to delete a file using ACLs , you can view these permissions with ls -le to see the ACL flags set.. if you have a directory and you want to allow people to delete things in it you would do others allow delete_child.

This may be a bit off topic, but you can also set flags via chflags command. You can make so files cannot be deleted or modified at all.

DragonFly On-Line Manual Pages : chflags(1)

I'm not much of an AIX person, but try the 'aclget' command.. that might help..?

The user mounting the filesystem is somewhat irrelevant..

Another possibility is the 'rm' command being aliased to something like

alias rm='sudo rm -i'

with sudoers file being set up to restrict the command.

Thanks Ceubank for the reply.

Actually I'd like to say sorry for dragging so many people into this...I just found out the directory owner was changed to the userid just one second before that I did the delete, that's why I got the impression why I could delete someone else's file without the permission being set...that was silly I should have checked back the dir permission first for the doubt.