Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

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

Catch 22: If I open my text editor without using sudo, I don't have permission to save any changes. If I open it with root privileges, any files I create are owned by root. I want to be able to create files that are owned by me (non-root user), and also edit files that require root access in the same session. Possible? Is this a Linux thing or a text editor setting?

I'm using Sublime Text 2.

share|improve this question
up vote 1 down vote accepted

If you use sudoedit to edit your root-owned text files, then your editor will be running as you. Sudoedit works by making a temporary copy of the root-owned file(s), owned by you, and invoking your editor (chosen via $SUDO_EDITOR, $VISUAL, $EDITOR, or the sudoers config file) on it. When you quit the editor, it copies the temporary file(s) back if they're modified. Full details are in the man page.

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.