Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use SSH and SUDO together with TRAMP in Emacs [duplicate]

Tags:

Possible Duplicate:
Open file via SSH and Sudo with Emacs

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

like image 928
Jeevan Pingali Avatar asked Aug 12 '10 07:08

Jeevan Pingali


1 Answers

Use following in your .emacs

(set-default 'tramp-default-proxies-alist (quote ((".*" "\\`root\\'" "/ssh:%h:")))) 

Then you can simply type:

C-x C-f /sudo:root@host[#port]:/path/to/file 

It will ask you for your password to access remote shell and then your password again for sudo access.

like image 110
Maxim Filatov Avatar answered Sep 30 '22 01:09

Maxim Filatov