I got this Unix/Linux error message just now:
mv: cannot unlink '/tmp/forms-1.2.1.jar': Operation not permitted
I got that when trying to move (
mv) the file forms-1.2.1.jar from the /tmp directory to another directory. The full error output looked like this:
$ mv /tmp/forms-1.2.1.jar ~ mv: cannot unlink `/tmp/forms-1.2.1.jar': Operation not permitted mv: cannot remove `/tmp/forms-1.2.1.jar': Operation not permitted
I got this error message because I tried to move the /tmp/forms-1.2.1.jar file, but I wasn't the owner of the file. I did have read permission on the file, so I could read it and copy it. But because I wasn’t the owner, and I only had
644 permission on the file (
rw-r--r--), I couldn't delete the file, and hence could not move it.
This wasn’t a big deal in my case, because all I really needed to do was copy the file, and then ask the owner of the file to delete it, but if you really need to move the file, this is a problem.
FWIW, the reason you get this error is that moving a file is similar to first copying the file to a new location, and then deleting the original. (That’s not how it actually works, but you can safely think of it that way.) Because you’re not the owner of the file, you can’t delete it, unless it has something like
777 permissions (
So, if you really need to move a file and you're not the owner of the file, hopefully (a) you also have root access (because you can do most anything as root), or (b) you can talk to the owner of the file and ask them to move it or give you permission to move it.
This website is a little one-man operation. If you found this information helpful, I’d appreciate it if you would share it.