Showing posts with label remote server. Show all posts
Showing posts with label remote server. Show all posts

02 December 2011

Working on remote files using ssh and sudo in emacs/tramp

Working with emacs is always fun.
To work on remote files you will find enough information at Tramp tutorial, here i am talking about working with remote server and then use sudo to write some file.

For example : You are connecting remote machine using ssh as user1 and then you need to write file using user2 (actually sudo -u user2 filename) or better to say multiple hoping.

,-------------------------------------------------
| user1@remotehost ---> sudo -u user2 at remotehost filename
`-------------------------------------------------

Cool then, you need to add following line in your .emacs file.

set-default 'tramp-default-proxies-alist (quote ((".*" nil "/ssh:user1@%h:"))))
after saving and evaluating use

C-x C-f sudo:user2@remotehost:filename_path

Happy Hacking
gnumonk