Stéphane Senesi <[email protected]> writes:

> Michael

Hi Stéphane,

> Here it is :
>
>>  ssh -l my_bastion_user  bastion
> | ID | Site
> |----|-----------------------------------
> |  0 | [email protected]
> |  1 | [email protected]
> |  2 | [email protected]
> |  3 | [email protected]
> |  4 | [email protected]
> |  5 | [email protected]
> 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.

_______________________________________________
Tramp-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/tramp-devel

Reply via email to