It fails because you need to be the target (a) file owner, cp will not override basic unix security. A user can preserve their own files, wilmes -> wilmes, but cannot do so for other users, and certainly not for root. I am assuming that you are not logged in as root, nor as wilmes.
In this case, one file is owned by root, the other owned by wilmes. To preserve, you should try running:
sudo cp -p b a
Relevant links:
Example:
Create a file for root, a, and a file for a standard user (joe), b.
joe@testbed:~/tmp2$ sudo touch a
joe@testbed:~/tmp2$ touch b
Verify that the permissions are correct.
joe@testbed:~/tmp2$ ls -l
total 0
-rw-r--r-- 1 root root 0 Jun 22 13:51 a
-rw-r--r-- 1 joe joe 0 Jun 22 13:51 b
Attempt to copy user owned file, b, over root owned file (which would violate permissions):
joe@testbed:~/tmp2$ cp -p b a
cp: cannot create regular file 'a': Permission denied
Repeat copy as root, permissions preserved:
joe@testbed:~/tmp2$ sudo cp -p b a
joe@testbed:~/tmp2$ ls -l
total 0
-rw-r--r-- 1 joe joe 0 Jun 22 13:51 a
-rw-r--r-- 1 joe joe 0 Jun 22 13:51 b
Note: Permission denied, not Operation not permitted. I imagine that you see not permitted because the user wilmes DOES have access to the file, by means of a group, however, they are not the owner, so they cannot entirely overwrite it.
Logically, you're replacing a file that belongs to another user (root) and asking the system to also make you the owner of that file, that would be a catastrophic security flaw.
For example, what if I came a long as a normal user, malicious.username01
and wanted to replace the crontab for something like ntp which belongs to root? If what you are trying to do worked, I could simply write my own malicious version of it and then simply cp -p my-malicious-script /etc/cron.daily/ntp
. This would be terrible. Really really terrible.