views:

121

answers:

2

I want to open a file using sudo (say, /etc/hosts) on a remote machine connected by ssh using TRAMP on Emacs.

I tried couple of options, but none of them worked. Can anybody tell me how to go about it?

Thank you

A: 

In recent Emacsen and Unixes it's dead simple, just visit a file (C-x C-f) and start the file name with ssh://server:/file.

If you are using Windows, first install Putty and put it in your PATH environment variable. Then when you visit a file use plink://server:/file instead of ssh://server:/file.

wm_eddie
Would that not require him to authenticate as root?
Joel J. Adamson
ssh will by default use your current username. You can another one by using `ssh://username:password@server:/file` Entering the password every time gets tedious really fast though, so I suggest setting up public-key authentication (then it's just `ssh://username@server:/file`).
wm_eddie
A: 

Duplicate of: Open file via SSH and Sudo with Emacs

See documentation here: http://www.gnu.org/software/tramp/#Multi_002dhops

phils