I have a file on my Debian Stretch server that has the following security attribute: -rw-r--r--, owned by root.

If I login as root directly (su -), I can edit and save it. But if I try to do sudo nano filename to open it with my admin user login, when I try to save it it gives me a permission denied error (and wants me to save it as a new file, instead of overwriting the current one).

Why would this be?

  • is your user allowed to execute sudo nano on the server? – Alex Jun 21 '18 at 15:19
  • @Alex yes. Updating question to be a bit more clear. – contactmatt Jun 21 '18 at 15:20
  • Where is the file located? Is it on a local filesystem or maybe on nfs/fuse fs? – Zoredache Jun 21 '18 at 15:56
  • @Zoredache it's on EC2 - local on the EBS volume – contactmatt Jun 21 '18 at 16:24
  • Does it work if you rename the file or use a different editor? I'm wondering if this has something to do with nano trying to create a temporary file or loading different profile settings. – GuitarPicker Jun 23 '18 at 2:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.