Super User is a question and answer site for computer enthusiasts and power users. 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


I'm working on my personal VPS configured mostly for learning sysadmin and personal projects. Have run up against an issue where my non-root user could only create/edit files in emacs by using sudo command. This is not an issue with directory permissions since I can create files with touch without sudo.

  • Can't recall, but emacs may have been initially installed by the root user.
  • User was created and added as follows:
    • root@hadron:~# adduser my_user
    • root@hadron:~# addgroup admin
    • root@hadron:~# adduser my_user admin


Running a command like emacs newfile.txt would always open a blank document that couldn't be saved, and noted the following in the file path at the bottom of the terminal: File exists: /home/my_user/.emacs.d/

Checking that .emacs.d file, the permission was as follows:

  • drwx------ 3 root root 4096 2012-03-26 08:07 .emacs.d

Changing the permission of the .emacs.d file to allow anyone to access it resolved the situation, but that doesn't seem like the proper solution:

  • chmod 777 ~/.emacs.d
  • drwxrwxrwx 3 root root 4096 2012-03-26 08:07 .emacs.d

What is the appropriate way of addressing this?

share|improve this question
up vote 1 down vote accepted

It is not completely clear which user tries to run the emacs.

Also it is unclear what the command

$ adduser my_user admin

does. Do you mean

$ adduser --group admin my_user


The directory .emacs.d in the user's home should be owned by the user himself. So a

$ chown -R my_user ~/.emacs.d
$ # Fix the 'broken' permissions
$ chmod go-w ~/.emacs.d

In the last command you might want to add also the x and r flag to remove read and execute permissions for group and other.

share|improve this answer
Grazie. chown -R was what I was missing here. Following up, $ chmod go-w ~/.emacs.d gives the following error on my system: "chmod: cannot access `go-w': No such file or directory" But I've gone ahead with chmod 700, and confirmed all is working as expected. – CdrXndr Apr 22 '12 at 21:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .