Skip to main content
1 of 2
Vlastimil Burián
  • 31.1k
  • 66
  • 210
  • 358

sudoedit root owned file in a non-root directory

Why can't I edit files owned by root but being e.g. somewhere deep in my personal directory, it says:

sudoedit: existingFile: editing files in a writable directory is not permitted

While I have the following function defined:

function sunano {
    export SUDO_EDITOR='/usr/local/bin/nano'
    sudoedit "$@"
}

And I edit like this:

sunano existingFile

Where the file is indeed owned by root:

ls -l existingFile

Proves that:

-rwxr-xr-x 1 root root 40 Jun 15  2015 existingFile
Vlastimil Burián
  • 31.1k
  • 66
  • 210
  • 358