Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 in ~/Documents. I tried to use this command at the terminal and received this message:

david@my-pc:~/Documents$ chmod +x ./
chmod: changing permissions of `./': Operation not permitted

However, when I prepended sudo to the beginning, it worked:

david@my-pc:~/Documents$ sudo chmod +x ./
david@my-pc:~/Documents$ ls -lh
total 28K
... (files) ...
-rwxr-xr-x 1 root  root    44 Aug  8 15:32
... (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?

share|improve this question
Can you please post the output of ls -l /home/david and ls -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, or sudo wget, right? – reverendj1 Aug 8 '12 at 20:14
Oops, I meant ls -ld /home/david and ls -ld /home/david/Documents. – reverendj1 Aug 8 '12 at 20:25
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 – wecsam Aug 9 '12 at 13:52
Gah, I can't make the line breaks appear. – wecsam Aug 9 '12 at 13:53
Oh, just add them to the answer. I can see they are correct though. – reverendj1 Aug 9 '12 at 13:57
up vote 5 down vote accepted

It seems to be a permission issue. From the output i can see, that the file is owned by root. Only from the root account (but including with sudo) you can make changes to the file's permissions. You need the change the ownership of the file. Run this command in the Terminal to take ownership of all the files in your home directory:

sudo chown -R $USER:$USER $HOME
share|improve this answer
Hm, that's weird. I created those files in gedit running under my user account. Do you know how that could have happened? Both /home/david and /home/david/Documents are owned by me. – wecsam Aug 9 '12 at 13:55

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.