For some reason, I can't chmod +x
files that are right in my home folder without prepending sudo
to the command.
One recent example: I have a file named monitor-off.sh
in ~/Documents
. I tried to use this command at the terminal and received this message:
david@my-pc:~/Documents$ chmod +x ./monitor-off.sh
chmod: changing permissions of `./monitor-off.sh': Operation not permitted
However, when I prepended sudo
to the beginning, it worked:
david@my-pc:~/Documents$ sudo chmod +x ./monitor-off.sh
david@my-pc:~/Documents$ ls -lh
total 28K
... (files) ...
-rwxr-xr-x 1 root root 44 Aug 8 15:32 monitor-off.sh
... (files) ...
I know that I shouldn't be overusing sudo
like this, so what can I do to fix things so that I can use chmod
without sudo
?
ls -l /home/david
andls -l /home/david/documents
? That will show us that you have correct permission to the folders. Also, you aren't perhaps creating these scripts with sudo, i.e.sudo nano monitor-off.sh
, orsudo wget http://somewebsite.com/monitor-off.sh
, right?ls -ld /home/david
andls -ld /home/david/Documents
.david@my-pc:~$ ls -ld /home/david
drwxr-xr-x 28 david david 4096 Aug 9 08:57 /home/david
david@my-pc:~$ ls -ld /home/david/Documents
drwxr-xr-x 4 david david 4096 Aug 8 16:01 /home/david/Documents