Is chmod enough to change the permissions? My file needs sudo everytime I have file copied from an usb hard drive with a previous installation of os yosemite copied in it. Now I'm using Sierra.

The status of the file:

karim@doraemon:~/Downloads
$ ll Python.recipes.handbooks.pdf
-rw-r--r--@ 1 karim  staff   4.5M Jan  3 19:42 Python.recipes.handbooks.pdf


I have the same name user of my previous installation, maybe this could be a problem, but I'm not sure because from the finder, if I check permissions, I get 'Karim (Me)' as a owner.

karim@doraemon:~/Downloads
$ whoami
karim


I change the permissions:

karim@doraemon:~/Downloads
$ chmod 777 Python.recipes.handbooks.pdf


The file permissions are changed.

karim@doraemon:~/Downloads
$ ll Python.recipes.handbooks.pdf
-rwxrwxrwx@ 1 karim  staff   4.5M Jan  3 19:42 Python.recipes.handbooks.pdf


As you can see, I'can't modify the filename.

karim@doraemon:~/Downloads
$ mv Python.recipes.handbooks.pdf Python.recipes.handbooksaa.pdf
mv: rename Python.recipes.handbooks.pdf to Python.recipes.handbooksaa.pdf: Permission denied


I already checked on finder and the file is not locked.

As suggested I run this:

karim@d:~/Downloads
$ ls -leO@ Python.recipes.handbooks.pdf
-rwxrwxrwx@ 1 karim  staff  - 4758205 Jan  3 19:42 Python.recipes.handbooks.pdf
    com.apple.finder.copy.source.checksum#N       4
    com.apple.metadata:_kTimeMachineNewestSnapshot       50
    com.apple.metadata:_kTimeMachineOldestSnapshot       50
    com.dropbox.attributes       83
 0: group:everyone deny write,delete,append,writeattr,writeextattr,chown


The last line seems to explain what is happening on the file.
It looks like those files are coming from a Time Machine backup, and still have the don't-mess-up-the-backup access control ("group:everyone deny write,delete,append,writeattr,writeextattr,chown") attached. You can remove this with e.g.

chmod -N Python.recipies.handbooks.pdf


You might also want to remove the stray extended attributes with

xattr -c Python.recipies.handbooks.pdf