2

I have a shell script that I execute after uninstalling a web application. The script is meant to clean up permissions that were needed during the execution of the application.

find /opt/path -exec setacl -d user:myUser {} ';'

After this executes and the acl is removed I am left with an acl that looks as follows

user:101:--- /opt/path

How can I properly call setacl to remove the user without leaving behind a uid?

2
  • Can you show the output from getacl /opt/path before you run anything, and then afterwards too? Plus the output of ls -ld /opt/path both before and after too. That way, there's a chance we'll see what's changed. What was the UID of myUser?
    – Jonathan Leffler
    Jan 15, 2011 at 0:35
  • @Jonathan the UID was 101 of the user, I am not sure if that is coincidental
    – Woot4Moo
    Jan 15, 2011 at 0:41

2 Answers 2

3

If you've quoted your command accurately as:

find /opt/path -exec setacl -d user:myUser{} ';'

you are missing a crucial space:

find /opt/path -exec setacl -d user:myUser {} ';'

The former invokes undefined (or maybe implementation-defined) behaviour from find; it might or might not expand the file name when the {} is not in an argument on its own. But it then invokes the setacl command with no filename; it combines the filename with the control argument user:myUser.

It is most unlikely to be correct as written - but I'm hoping that it is just a typo in your transcription from your system to SO.

3
  • Yeah, I just noticed, but if the missing space was a problem, I think there would be an error from setacl, or it would do nothing. Jan 15, 2011 at 0:22
  • Yeah - I think we can treat it as a transcription error. On a HP-UX machine, running $setacl -d user:101$PWD generated unknown user-id "101/u/jleffler". So, technically an accurate answer, but not really the help the question needed.
    – Jonathan Leffler
    Jan 15, 2011 at 0:28
  • Oops typo on my part.
    – Woot4Moo
    Jan 15, 2011 at 0:28
1

Is user 101 the owner of the file? If so, you need to change the file to a different user ID, with chown (in addition to, or in lieu of, the setacl call). Every file belongs to one user and one group; ACLs come in addition to that.

Note that I've never used ACLs on HP/UX, so I may be missing something.

It might help if you showed the output of ls -ld /opt/path and getacl /opt/path before you run that find command.

1
  • root:sys as owner:group
    – Woot4Moo
    Jan 15, 2011 at 0:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.