The command chmod -x filename
doesn't work for me.
When I execute the command like this:
chmod -r filename
chmod -w filename
chmod -x filename
They complete without any error. But the permission of the files doesn't get affected.
I think you're confusing -
with +
. One adds a permission, the other removes it. Here's a silly little test with a new file that starts with global rwx
(aka 0777):
$ install -m 777 <(echo) test; ls -l test
-rwxrwxrwx 1 oli oli 1 Oct 3 13:34 test
Let's remove read permissions with -r
:
$ chmod -r test; ls -l test
--wx-wx-wx 1 oli oli 1 Oct 3 13:34 test
And add them back with +r
:
$ chmod +r test; ls -l test
-rwxrwxrwx 1 oli oli 1 Oct 3 13:34 test
Try executing your commands in sudo
mode.
sudo chmod -r /path/to/file/filename
sudo chmod -w /path/to/file/filename
sudo chmod -x /path/to/file/filename
And make sure the account you are using has the right permissions to change those properties.
sudo
laurent@Hoedic-U14:~$ chmod u+w /etc/wgetrc chmod: changing permissions of ‘/etc/wgetrc’: Operation not permitted
Oct 3, 2014 at 12:42
If none of these are given, the effect is as if a were given, but bits that are set in the umask are not affected.
(man chmod). Trychmod u+x filename
instead.