tramp-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Default user and host (even if only for su/sudo)?


From: Ted Zlatanov
Subject: Re: Default user and host (even if only for su/sudo)?
Date: Thu, 21 Nov 2002 11:01:17 -0500
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2 (sparc-sun-solaris2.8)

On Thu, 21 Nov 2002, address@hidden wrote:
>         I've been using tramp for a while, it's really helpful. I
>         use it mostly with "sudo", to edit system files in my always
>         open xemacs (instead of "sudo vi").
> 
>         However, having to type "/address@hidden" is getting old
>         faster
> and faster :)
> 
>         In fact, in the sudo and su methods I'm not even allowed a
>         host
> other than "localhost", and I still have to type it!
> 
>         What do you think?

I use the following, mostly stolen from someone else...

(defvar find-file-root-method "multi/sudo:"
  "*The Tramp method to use for opening files with `find-file-root'.")
(defvar find-file-root-user   "root"
  "*The user to su to when opening files with `find-file-root'.")
(defvar find-file-root-host   "localhost"
  "*The host to use when opening files with `find-file-root'.")

(defun find-file-root (file)
  "Open FILE sued to a different user..
Uses the method specified in `find-file-root-method' and the user from
`find-file-root-user'."
  (interactive "FFind file (as UID 0): ")
  (require 'tramp)
  (find-file (concat "/[" find-file-root-method find-file-root-user "@" 
find-file-root-host "]" file)))

(global-set-key [(control x) (control r)] 'find-file-root)

Ted




reply via email to

[Prev in Thread] Current Thread [Next in Thread]