Ubuntu – Cannot write to newly created file

permissionsUbuntu

I have an ubuntu server. I created a simple index.html file using touch. and tried to use nano and it turns out the permission is denied. Why is this? If I just made the file on the server why wouldn't I have write access in the first place? My second question is if I wanted to change the permissions to the number format 644 (is that what a html file on the server should be set to?) how do I view what it currently is how do I convert -rw-rw-r-- to the numeral format? I want to view -ls -l with the numeral permissions format rather then -rw-rw-r--. The index.html file is running on the server alright.

thomas@vannevar:~/public/example.org/public$ touch index.html
thomas@vannevar:~/public/example.org/public$ ls
index.html
thomas@vannevar:~/public/example.org/public$ nano index.html

Error reading /home/thomas/.nano_history: Permission denied

Press Enter to continue starting nano.

thomas@vannevar:~/public/example.org/public$ ls -l
total 0
-rw-rw-r-- 1 thomas thomas 0 May 17 13:57 index.html
thomas@vannevar:~/public/example.org/public$ 

THIS WORKS

http://pricklytech.wordpress.com/2010/12/12/ubuntu-nano-error-reading-home-nano_history-permission-denied/

Best Answer

Your problem is reading nano's history file (.nano_history), as indicated very clearly in this massively whitespaced error line:

thomas@vannevar:~/public/example.org/public$ nano index.html

Error reading /home/thomas/.nano_history: Permission denied

Press Enter to continue starting nano.

This is opened prior to nano opening your file (which works fine because 644 is okay for this)

Looks like your home folder/.nano_history's permissions might be set too tight.


Following your comment:

-rw------- 1 root root 111 May 17 14:13 /home/thomas/.nano_history

As you can see only root's user has read and write permissions, no one else.

You want to do sudo chown thomas:thomas ~/.nano_history to fix this issue.