help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Passing Username for M-x rsh


From: Katsumi Yamaoka
Subject: Re: Passing Username for M-x rsh
Date: Wed, 15 Mar 2006 19:52:33 +0900
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

>>>>> In <mailman.49.1142416858.9686.help-gnu-emacs@gnu.org>
>>>>>   Annamalai Gurusami wrote:

> When I use M-x rsh to login to a remote host, how can I specify the
> username?  When I do M-x rsh, I am prompted for a hostname; Once I
> provide the hostname, I am then prompted for a password, without being
> asked for a username.

> Currently, I provide a wrong password, and then I get prompted for a
> username.  This is cumbersome.  Any help?

You can override the rsh command like the following (it can be
added to the ~/.emacs file):

(defadvice rsh (around prompt-for-username (host &optional user) activate)
  "If given a prefix argument, prompt for a user name."
  (interactive "sOpen rsh connection to host: \nP")
  (if (and user
           (interactive-p))
      (setq user
            (let ((minibuffer-setup-hook '(beginning-of-line)))
              (read-string "User name: "
                           (user-login-name) nil (user-login-name)))))
  (require 'shell)
  (let ((name (concat "rsh-" host )))
    (pop-to-buffer
     (if user
         (make-comint name remote-shell-program nil host "-l" user)
       (make-comint name remote-shell-program nil host)))
    (set-process-filter (get-process name) 'telnet-initial-filter)
    (telnet-mode)
    (setq telnet-count -16)))


reply via email to

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