Table of Contents
SSH to Edit Remote File
Use the find file function with SPC f . and enter the following pattern:
/ssh:<username>@<remotehost>:/<path>/<to>/<file>Emacs Sudo Issues and SSH Privileges
Your Tramp session inherits whatever privileges belong to the user you logged in as. If you log in as the root user, you have complete access to your server.
Otherwise, you would need to pass sudo privileges into your session:
/sudo::/path/to/fileIssues accessing remote machine with fancy prompt
I’m using ZSH, with some custom config and it appears that this is what is causing my issues logging into machines using tramp, as logging in via root works fine.
This is explained further in sources below: https://stackoverflow.com/questions/6954479/emacs-tramp-doesnt-work https://www.bounga.org/tips/2017/11/30/fix-emacs-tramp-lag-and-timeout/
The most simple fix is to include the following in .zshrc on the remote machine.
if [[ $TERM == "dumb" ]]; then
export PS1="$ "
fiThere is another source which mentions issues with something called ZLE as reported in the Tramp manual. This suggests adding the following:
[ $TERM == "tramp" ]] && unsetopt zle && PS1='$ ' && returnWhen Tramp connects to a remote host it sets the TERM environment variable as dumb so you know you’re in the situation were you want a really simple prompt. What to do then is to set the prompt to a simple “$ “ string.
EmacsWiki describes the problem as follows:
If you are using zsh, the zle option can cause this behaviour. The Tramp manual does actually note this in 4.16 Remote shell setup hints, and provides a possible workaround there (namely, if you tell TRAMP you’re using zsh, it will automatically supply some extra flags to configure things appropriately; you can see the flags it uses in tramp-sh-extra-args).
Additionally, with the default settings, using sshx rather than ssh will likely work because it will tell the remote host to run /bin/sh instead of zsh.