3
[martin@A08-R32-I196-2-FZ1RLP2 anaconda3]$ groups martin
martin : martin wheel

I am under my own home directory:

[martin@A08-R32-I196-2-FZ1RLP2 anaconda3]$ pwd
/home/martin/anaconda3

But when I tried delete a file in my own directory, I received this error:

[martin@A08-R32-I196-2-FZ1RLP2 anaconda3]$ rm test2.ipynb
mv: cannot create regular file ‘/export/.trash/test2.ipynb’: Permission denied

Why is that?

  • It looks like you have an alias or overriding script for rm; please edit in the output of type rm. – Michael Homer Aug 11 '18 at 2:56
1

Background

The 3rd example you showed where you're attempting to rm the file looks to have the rm command overloaded with a sequence of commands, one of which, attempts to do a mv of the file to /export/.trash.

Permissions

[martin@A08-R32-I196-2-FZ1RLP2 anaconda3]$ rm test2.ipynb mv: cannot create regular file ‘/export/.trash/test2.ipynb’: Permission denied

Look at the permissions for /export/.trash/:

$ ls -ld /export/.trash

Everything should be owned by your user 'martin' so that this account can delete files and optionally mv them to this directory.

I suspect someone used the sudo command when working in this directory and, perhaps accidentally, set the permissions of the .trash directory so that root owns it.

Overloaded command

Regarding your rm command. You can check if it's been overloaded as an alias or a shell function with the same name using the type command. Examples:

$ type -f rm
rm is aliased to `rm -i'

$ type -f mv
mv is aliased to `mv -i'

Here we can see that the mv and rm commands have been overloaded as aliases to mv -i and rm -i.

0

I agree that the output from rm indicates the rm is an alias or a function doing something else, from the path name it seems to try to move to a trash directory instead of removing.

To address the original question, group 0 (wheel) basically means nothing. On BSD based systems, su (not sudo) to root is restricted to members of the wheel grouup, but that is just a function of the su command on BSD and not a function of the OS itself.

The sudo command is commonly used on Linux. It is highly configurable. Membership in group 0 can be made a requirement to be able to use sudo, but doesn't automatically use sudo.

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.