johnsu01 (johnsu01) wrote,

Tramp and file permissions

I use Tramp from Emacs a lot both at home and at work. I use it to update this web site, for example. It's very handy for editing files on remote machines. You can edit files on many different machines from a single emacs session, which means you can always have the same .emacs environment, and you can use the emacs GUI to edit files on machines where you wouldn't normally have X or X forwarding access.

One problem I've run into, though, is that it mucks with file permissions. When I create a new file on the remote machine, everything is fine; the permissions are set according to the umask. However, when I edit a file that is already there, the permissions of the saved revision will be set such that no one can read, write or execute the file. I haven't figured out a complete solution to this yet, but here's a temporary workaround:

(setq backup-by-copying t)

That will make it so that the permissions on your revision will be correct. But, now the permissions on your backup will be all wrong. For now, I can live with that, since they are wrong in the sense that no one can read or write the file, which is probably actually ok when it comes to backup files.

Tags: emacs
  • Post a new comment


    default userpic
    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.