Turning off remote backups

Ben Sturmfels <[email protected]>
Newsgroups gmane.emacs.tramp
Message-ID <[email protected]>
Hi folks,

When using TRAMP to edit a remote WordPress wp-config.php file, I'd like to prevent backup files being created, since the adjacent wp-config.php~ could expose passwords if Apache serves it directly without being interpreted as PHP. In the TRAMP documentation, "4.23 Auto-save, File Lock and Backup configuration", it says:

> To “turn off” the backup feature for remote files and stop TRAMP from
> saving to the backup directory, use this:
>
>      (add-to-list 'backup-directory-alist
>                   (cons tramp-file-name-regexp nil))

This sounded like what I wanted, but when I ran this Elisp on a fresh `emacs -Q` then opened, modified and saved a remote file, a backup file was still created.

Is this snippet intended for turn off remote backups entirely, or only to deal with the specific case of backups owned by root being  made accessible to others? The "To “turn off” the backup feature" wording is slightly confusing if it's only intending to reset backup directory customizations.

Two suggestions that might help clarify the documentation:

1. Instead of:

> To “turn off” the backup feature for remote files and stop TRAMP from
> saving to the backup directory, use this:

perhaps:

> To stop TRAMP from saving to the custom backup directory, use this:

2. Add another example after this, perhaps something like:

> To “turn off” remote backups entirely:
>
> (setq backup-enable-predicate
>      (lambda (name)
>        (and (normal-backup-enable-predicate name)
>             (not (file-remote-p name)))))

Thanks for your work on TRAMP. I find it incredibly useful!

Regards,
Ben
tramp-bug-output.txt (text/plain, 125.6 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.