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

In ubuntu, I use a program written by others. This program creates a file on my system and try to read and write it later. But the permission of the file it creates is read-only. How can I change the default permission when creating a file in ubuntu, in home folder. Thanks ahead.

share|improve this question
It depends on the program you use. The program would create a file and set its permissions. So, unless you change the source code, you can't do much other than manually changing the permissions. – green Apr 17 '13 at 15:31
I tried to create a file by using vi. The owner is me. Files created by the program belong to root. Can I do something to change that? – Juneyee Apr 17 '13 at 15:36
Post the output of umask. – green Apr 17 '13 at 15:59
the output is 0002 – Juneyee Apr 17 '13 at 18:10
And the output of echo $USERNAME? Also, what command do you use to create a file using vi ? – green Apr 17 '13 at 18:20

I got the answer with green7's help. When I use sudo with other commands, the owner is root and when I use command without sudo, the owner is me.

share|improve this answer

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.