+The other approach is to teach @value{tramp} about these questions. See
+the variables @code{tramp-actions-before-shell} and
+@code{tramp-multi-actions} (for multi-hop connections).
+
+
+@item Environment variables named like users in @file{.profile}
+
+If you have a user named frumple and set the variable @code{FRUMPLE} in
+your shell environment, then this might cause trouble. Maybe rename
+the variable to @code{FRUMPLE_DIR} or the like.
+
+This weird effect was actually reported by a @value{tramp} user!
+
+
+@item Non-Bourne commands in @file{.profile}
+
+After logging in to the remote host, @value{tramp} issues the command
+@code{exec /bin/sh}. (Actually, the command is slightly different.)
+When @code{/bin/sh} is executed, it reads some init files, such as
+@file{~/.shrc} or @file{~/.profile}.
+
+Now, some people have a login shell which is not @code{/bin/sh} but a
+Bourne-ish shell such as bash or ksh. Some of these people might put
+their shell setup into the files @code{~/.shrc} or @code{~/.profile}.
+This way, it is possible for non-Bourne constructs to end up in those
+files. Then, @code{exec /bin/sh} might cause the Bourne shell to barf
+on those constructs.
+
+As an example, imagine somebody putting @code{export FOO=bar} into the
+file @file{~/.profile}. The standard Bourne shell does not understand
+this syntax and will emit a syntax error when it reaches this line.
+
+Another example is the tilde (@code{~}) character, say when adding
+@file{~/bin} to @code{$PATH}. Many Bourne shells will not expand this
+character, and since there is usually no directory whose name consists
+of the single character tilde, strange things will happen.
+
+What can you do about this?
+
+Well, one possibility is to make sure that everything in @file{~/.shrc}
+and @file{~/.profile} on all remote hosts is Bourne-compatible. In the
+above example, instead of @code{export FOO=bar}, you might use
+@code{FOO=bar; export FOO} instead.
+
+The other possibility is to put your non-Bourne shell setup into some
+other files. For example, bash reads the file @file{~/.bash_profile}
+instead of @file{~/.profile}, if the former exists. So bash
+aficionados just rename their @file{~/.profile} to
+@file{~/.bash_profile} on all remote hosts, and Bob's your uncle.
+
+The @value{tramp} developers would like to circumvent this problem, so if you
+have an idea about it, please tell us. However, we are afraid it is not
+that simple: before saying @code{exec /bin/sh}, @value{tramp} does not know
+which kind of shell it might be talking to. It could be a Bourne-ish
+shell like ksh or bash, or it could be a csh derivative like tcsh, or
+it could be zsh, or even rc. If the shell is Bourne-ish already, then
+it might be prudent to omit the @code{exec /bin/sh} step. But how to
+find out if the shell is Bourne-ish?
+
+@end table
+
+
+@node Auto-save and Backup
+@section Auto-save and Backup configuration
+@cindex auto-save
+@cindex backup
+@ifset emacs
+@vindex backup-directory-alist
+@end ifset
+@ifset xemacs
+@vindex bkup-backup-directory-info
+@end ifset
+
+Normally, @value{emacsname} writes backup files to the same directory
+as the original files, but this behavior can be changed via the
+variable
+@ifset emacs
+@code{backup-directory-alist}.
+@end ifset
+@ifset xemacs
+@code{bkup-backup-directory-info}.
+@end ifset
+In connection with @value{tramp}, this can have unexpected side effects.
+Suppose that you specify that all backups should go to the directory
+@file{~/.emacs.d/backups/}, and then you edit the file
+@file{@value{prefix}su@value{postfixsinglehop}root@@localhost@value{postfix}/etc/secretfile}.
+The effect is that the backup file will be owned by you and not by
+root, thus possibly enabling others to see it even if they were not
+intended to see it.
+
+When
+@ifset emacs
+@code{backup-directory-alist}
+@end ifset
+@ifset xemacs
+@code{bkup-backup-directory-info}
+@end ifset
+is nil (the default), such problems do not occur.
+
+Therefore, it is usefull to set special values for @value{tramp}
+files. For example, the following statement effectively `turns off'
+the effect of
+@ifset emacs
+@code{backup-directory-alist}
+@end ifset
+@ifset xemacs
+@code{bkup-backup-directory-info}
+@end ifset
+for @value{tramp} files:
+
+@ifset emacs
+@lisp
+(add-to-list 'backup-directory-alist
+ (cons tramp-file-name-regexp nil))
+@end lisp
+@end ifset
+@ifset xemacs
+@lisp
+(require 'backup-dir)
+(add-to-list 'bkup-backup-directory-info
+ (list tramp-file-name-regexp ""))
+@end lisp
+@end ifset
+
+Another possibility is to use the @value{tramp} variable
+@ifset emacs
+@code{tramp-backup-directory-alist}.
+@end ifset
+@ifset xemacs
+@code{tramp-bkup-backup-directory-info}.
+@end ifset
+This variable has the same meaning like
+@ifset emacs
+@code{backup-directory-alist}.
+@end ifset
+@ifset xemacs
+@code{bkup-backup-directory-info}.
+@end ifset
+If a @value{tramp} file is backed up, and DIRECTORY is an absolute
+local file name, DIRECTORY is prepended with the @value{tramp} file
+name prefix of the file to be backed up.
+
+@noindent
+Example:
+
+@ifset emacs
+@lisp
+(add-to-list 'backup-directory-alist
+ (cons "." "~/.emacs.d/backups/"))
+(setq tramp-backup-directory-alist backup-directory-alist)
+@end lisp
+@end ifset
+@ifset xemacs
+@lisp
+(require 'backup-dir)
+(add-to-list 'bkup-backup-directory-info
+ (list "." "~/.emacs.d/backups/" 'full-path))
+(setq tramp-bkup-backup-directory-info bkup-backup-directory-info)
+@end lisp
+@end ifset
+
+@noindent
+The backup file name of
+@file{@value{prefix}su@value{postfixsinglehop}root@@localhost@value{postfix}/etc/secretfile}
+would be
+@ifset emacs
+@file{@value{prefix}su@value{postfixsinglehop}root@@localhost@value{postfix}~/.emacs.d/backups/!su:root@@localhost:!etc!secretfile~}
+@end ifset
+@ifset xemacs
+@file{@value{prefix}su@value{postfixsinglehop}root@@localhost@value{postfix}~/.emacs.d/backups/![su!root@@localhost]!etc!secretfile~}
+@end ifset
+
+The same problem can happen with auto-saving files.
+@ifset emacs
+Since @value{emacsname} 21, the variable
+@code{auto-save-file-name-transforms} keeps information, on which
+directory an auto-saved file should go. By default, it is initialized
+for @value{tramp} files to the local temporary directory.
+
+On some versions of @value{emacsname}, namely the version built for
+Debian Linux, the variable @code{auto-save-file-name-transforms}
+contains the directory where @value{emacsname} was built. A
+workaround is to manually set the variable to a sane value.
+
+If auto-saved files should go into the same directory as the original
+files, @code{auto-save-file-name-transforms} should be set to nil.
+
+Another possibility is to set the variable
+@code{tramp-auto-save-directory} to a proper value.
+@end ifset
+@ifset xemacs
+For this purpose you can set the variable @code{auto-save-directory}
+to a proper value.
+@end ifset