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 in process to set up a DHCP server on Ubuntu 12.04 Desktop.

I need to edit the file: /etc/default/isc-dhcp-server

How can I make it editable and save after applying necessary changes?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Try:

$ SUDO_EDITOR=/path/to/text-editor sudoedit /etc/default/isc-dhcp-server

From the sudo(8) manpage:

When invoked as sudoedit, the -e option (described below), is implied.

[…]

The -e (edit) option indicates that, instead of running a command, the user wishes to edit one or more files.

[…]

  1. Temporary copies are made of the files to be edited with the owner set to the invoking user.
  2. The editor specified by the policy is run to edit the temporary files. The sudoers policy uses the SUDO_EDITOR, VISUAL and EDITOR environment variables (in that order). […]
  3. If they have been modified, the temporary files are copied back to their original location and the temporary versions are removed.
share|improve this answer

Your Answer

 
discard

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.