Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am having trouble with setting up the .emacs file so that I, group and others can all read my files. I played around with C-x C-q but after I open the file and save it again only I can read/write the file. I have also used chmod +r (filename), but the problem happens again when I reload emacs. I don't want to use chmod +r everytime I edit my files. I am using Ubuntu 11.04 Codename: natty and connecting to a server that uses Mac OSX 10.5.8. I use sftp to connect to the server.

I have checked the umask on both machines and they are both 22 or 0022. I don't know if the sftp or .emacs file is causing this error. I just want to know if I am doing the whole thing wrong or something in emacs isn't setup up right.

share|improve this question
did you check with starting with emacs -Q. bit unclear to me about what is happening. could you show minimal example like, ls -l myfile before and after editing. –  kindahero Jun 22 '11 at 19:38
@kindahero I just tried using emacs -Q but I think it is still causing the problem. Before edit: [server:~] myusername% ls -l test23 -rw-r--r-- 1 myusername staff 15 Jun 23 11:03 test23 Then I open the file using emacs installed on my computer, edited the file and saved it: [server:~] myusername% ls -l test23 -rw------- 1 myusername staff 14 Jun 23 11:07 test23 If I use chmod +r while emacs is running, nothing happens to file permissions. As soon as I exit emacs and reload it, the problem starts again. –  Siddharth Jun 23 '11 at 15:12
Before edit: [server:~] myusername% ls -l test23 -rw-r--r-- 1 myusername staff 15 Jun 23 11:03 test23 After edit: [server:~] myusername% ls -l test23 -rw------- 1 myusername staff 14 Jun 23 11:07 test23 –  Siddharth Jun 23 '11 at 15:36
These should be ls -al since .emacs is a hidden file (name starts with a dot). –  Nikana Reklawyks Nov 18 '12 at 19:41

1 Answer 1

If you want all files in your $HOME directory to be readable by all, run :

find ~/ -type f -print0 | xargs -0 chmod 644

to set their permissions (taken from here). This is unrelated with emacs opening them : emacs will just follow the rights the filesystem constrains it to.

If the files permissions happen to change while you're away, something must be changing them, and you should look for that.

It also unrelated to with emacs being able to write in buffers that happen to visit these files. You should always be able to edit buffers, you can allow/prevent this with C-x C-q. The thing is if you make a non-writtable file's buffer writtable, you won't be able to save the changes to disk, and on the contrary, if you make a writtable file's buffer read-only, you could save any change to disk, but you prevent yourself from making such changes inside the emacs buffer. I don't see why you'd want to use that, from what you describe.

C-x C-q runs the command toggle-read-only
Change whether this buffer is read-only.

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.