tramp-devel
[Top][All Lists]
Advanced

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

Re: How to configure my bastion ?


From: Michael Albinus
Subject: Re: How to configure my bastion ?
Date: Fri, 04 May 2012 20:20:27 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux)

Stéphane Senesi <address@hidden> writes:

> Michael

Hi Stéphane,

> Here it is :
>
>>  ssh -l my_bastion_user  bastion
> | ID | Site
> |----|-----------------------------------
> |  0 | address@hidden
> |  1 | address@hidden
> |  2 | address@hidden
> |  3 | address@hidden
> |  4 | address@hidden
> |  5 | address@hidden
> Connect to:

You need an entry in ~/.ssh/config for every alternative, this entry
will be used as hostname in Tramp. Let's say

Host rjvg003-gaya
     Hostname bastion
     User my_bastion_user

Than you add to Tramp entries like this (untested):

(defconst my-tramp-prompt-regexp
  (concat (regexp-opt '("Connect to:") t)
          "\\s-*")
  "Regular expression matching my login prompt question.")

(defun my-tramp-action (proc vec)
  "Enter the ssh ID depending on the host."
  (save-window-excursion
    (let ((host (tramp-file-name-host vec))
      (with-current-buffer (tramp-get-connection-buffer vec)
        (tramp-message vec 6 "\n%s" (buffer-string))
        (cond
          ((string-equal host "rjvg003-gaya")
           (tramp-send-string vec "0"))
          ((string-equal ... ))))))))

(add-to-list 'tramp-actions-before-shell
             '(my-tramp-prompt-regexp my-tramp-action))

> Regards
>
> S

Best regards, Michael.



reply via email to

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