Works like @option{ssh} but without the extra authentication prompts.
@option{sshx} uses @samp{ssh -t -t @var{host} -l @var{user} /bin/sh}
-to open a connection with a ``standard'' login shell.
+to open a connection with a ``standard'' login shell. It supports to
+change the remote login shell @command{/bin/sh}.
@strong{Note} that @option{sshx} does not bypass authentication
questions. For example, if the host key of the remote host is not
@option{plink} method is for MS Windows users with the PuTTY
implementation of SSH@. It uses @samp{plink -ssh} to log in to the
-remote host.
+remote host. It supports to change the remote login shell
+@command{/bin/sh}.
Check the @samp{Share SSH connections if possible} control for that
session.
Another method using PuTTY on MS Windows with session names instead of
host names. @option{plinkx} calls @samp{plink -load @var{session}
--t}. User names and port numbers must be defined in the session.
+-t}. User names and port numbers must be defined in the session. It
+supports to change the remote login shell @command{/bin/sh}.
Check the @samp{Share SSH connections if possible} control for that
session.
@option{scpx} is useful to avoid login shell questions. It is similar
in performance to @option{scp}. @option{scpx} uses @samp{ssh -t -t
-@var{host} -l @var{user} /bin/sh} to open a connection.
+@var{host} -l @var{user} /bin/sh} to open a connection. It supports
+to change the remote login shell @command{/bin/sh}.
@option{scpx} is useful for MS Windows users when @command{ssh}
triggers an error about allocating a pseudo tty. This happens due to
they use @command{pscp} or @command{psftp} for transferring the files.
These programs are part of PuTTY, an SSH implementation for MS Windows.
+They support to change the remote login shell @command{/bin/sh}.
+
Check the @samp{Share SSH connections if possible} control for that
session.
@cindex zsh setup
Per default, @value{tramp} uses the command @command{/bin/sh} for
-strting a shell on the remote host. This can be changed by setting
+starting a shell on the remote host. This can be changed by setting
the connection property @option{remote-shell}, see @xref{Predefined
-connection information}. Other properties might be adapted as well,
-like @option{remote-shell-login} or @option{remote-shell-args}. If
-you want, for example, use @command{/usr/bin/zsh} on a remote host,
-you might apply
+connection information}. If you want, for example, use
+@command{/usr/bin/zsh} on a remote host, you might apply
@lisp
@group
@end group
@end lisp
+This works only for connection methods which allow to override the
+remote login shell, like @option{sshx} or @option{plink}. See
+@ref{Inline methods} and @ref{External methods} for connection methods
+which support this.
+
This approach has also the advantage, that settings in
@code{tramp-sh-extra-args} will be applied. For zsh, the trouble
with the shell prompt due to set zle options will be avoided.
you want to use another value for @env{TERM}, change
@code{tramp-terminal-type} and this line accordingly.
+Alternatively, you could set the remote login shell explicitly. See
+@ref{Remote shell setup} for discussing this technique,
+
When using fish shell on remote hosts, disable fancy formatting by
adding the following to @file{~/.config/fish/config.fish}:
(defvar vc-git-program)
(defvar vc-hg-program)
+;;;###tramp-autoload
+(defconst tramp-default-remote-shell "/bin/sh"
+ "The default remote shell Tramp applies.")
+
;;;###tramp-autoload
(defcustom tramp-inline-compress-start-size 4096
"The minimum size of compressing where inline transfer.
;;;###tramp-autoload
(tramp--with-startup
(add-to-list 'tramp-methods
- '("rcp"
+ `("rcp"
(tramp-login-program "rsh")
(tramp-login-args (("%h") ("-l" "%u")))
- (tramp-remote-shell "/bin/sh")
+ (tramp-remote-shell ,tramp-default-remote-shell)
(tramp-remote-shell-login ("-l"))
(tramp-remote-shell-args ("-c"))
(tramp-copy-program "rcp")
(tramp-copy-keep-date t)
(tramp-copy-recursive t)))
(add-to-list 'tramp-methods
- '("remcp"
+ `("remcp"
(tramp-login-program "remsh")
(tramp-login-args (("%h") ("-l" "%u")))
- (tramp-remote-shell "/bin/sh")
+ (tramp-remote-shell ,tramp-default-remote-shell)
(tramp-remote-shell-login ("-l"))
(tramp-remote-shell-args ("-c"))
(tramp-copy-program "rcp")
(tramp-copy-args (("-p" "%k")))
(tramp-copy-keep-date t)))
(add-to-list 'tramp-methods
- '("scp"
+ `("scp"
(tramp-login-program "ssh")
(tramp-login-args (("-l" "%u") ("-p" "%p") ("%c")
("-e" "none") ("%h")))
(tramp-async-args (("-q")))
- (tramp-remote-shell "/bin/sh")
+ (tramp-remote-shell ,tramp-default-remote-shell)
(tramp-remote-shell-login ("-l"))
(tramp-remote-shell-args ("-c"))
(tramp-copy-program "scp")
- (tramp-copy-args (("-P" "%p") ("-p" "%k") ("-q") ("-r") ("%c")))
+ (tramp-copy-args (("-P" "%p") ("-p" "%k") ("-q")
+ ("-r") ("%c")))
(tramp-copy-keep-date t)
(tramp-copy-recursive t)))
(add-to-list 'tramp-methods
- '("scpx"
+ `("scpx"
(tramp-login-program "ssh")
(tramp-login-args (("-l" "%u") ("-p" "%p") ("%c")
- ("-e" "none") ("-t" "-t") ("%h") ("/bin/sh")))
+ ("-e" "none") ("-t" "-t") ("%h")
+ ("%l")))
(tramp-async-args (("-q")))
- (tramp-remote-shell "/bin/sh")
+ (tramp-remote-shell ,tramp-default-remote-shell)
(tramp-remote-shell-login ("-l"))
(tramp-remote-shell-args ("-c"))
(tramp-copy-program "scp")
(tramp-copy-keep-date t)
(tramp-copy-recursive t)))
(add-to-list 'tramp-methods
- '("rsync"
+ `("rsync"
(tramp-login-program "ssh")
(tramp-login-args (("-l" "%u") ("-p" "%p") ("%c")
("-e" "none") ("%h")))
(tramp-async-args (("-q")))
- (tramp-remote-shell "/bin/sh")
+ (tramp-remote-shell ,tramp-default-remote-shell)
(tramp-remote-shell-login ("-l"))
(tramp-remote-shell-args ("-c"))
(tramp-copy-program "rsync")
- (tramp-copy-args (("-t" "%k") ("-p") ("-r") ("-s") ("-c")))
+ (tramp-copy-args (("-t" "%k") ("-p") ("-r") ("-s")
+ ("-c")))
(tramp-copy-env (("RSYNC_RSH") ("ssh" "%c")))
(tramp-copy-keep-date t)
(tramp-copy-keep-tmpfile t)
(tramp-copy-recursive t)))
(add-to-list 'tramp-methods
- '("rsh"
+ `("rsh"
(tramp-login-program "rsh")
(tramp-login-args (("%h") ("-l" "%u")))
- (tramp-remote-shell "/bin/sh")
+ (tramp-remote-shell ,tramp-default-remote-shell)
(tramp-remote-shell-login ("-l"))
(tramp-remote-shell-args ("-c"))))
(add-to-list 'tramp-methods
- '("remsh"
+ `("remsh"
(tramp-login-program "remsh")
(tramp-login-args (("%h") ("-l" "%u")))
- (tramp-remote-shell "/bin/sh")
+ (tramp-remote-shell ,tramp-default-remote-shell)
(tramp-remote-shell-login ("-l"))
(tramp-remote-shell-args ("-c"))))
(add-to-list 'tramp-methods
- '("ssh"
+ `("ssh"
(tramp-login-program "ssh")
(tramp-login-args (("-l" "%u") ("-p" "%p") ("%c")
("-e" "none") ("%h")))
(tramp-async-args (("-q")))
- (tramp-remote-shell "/bin/sh")
+ (tramp-remote-shell ,tramp-default-remote-shell)
(tramp-remote-shell-login ("-l"))
(tramp-remote-shell-args ("-c"))))
(add-to-list 'tramp-methods
- '("sshx"
+ `("sshx"
(tramp-login-program "ssh")
(tramp-login-args (("-l" "%u") ("-p" "%p") ("%c")
- ("-e" "none") ("-t" "-t") ("%h") ("/bin/sh")))
+ ("-e" "none") ("-t" "-t") ("%h")
+ ("%l")))
(tramp-async-args (("-q")))
- (tramp-remote-shell "/bin/sh")
+ (tramp-remote-shell ,tramp-default-remote-shell)
(tramp-remote-shell-login ("-l"))
(tramp-remote-shell-args ("-c"))))
(add-to-list 'tramp-methods
- '("telnet"
+ `("telnet"
(tramp-login-program "telnet")
(tramp-login-args (("%h") ("%p") ("2>/dev/null")))
- (tramp-remote-shell "/bin/sh")
+ (tramp-remote-shell ,tramp-default-remote-shell)
(tramp-remote-shell-login ("-l"))
(tramp-remote-shell-args ("-c"))))
(add-to-list 'tramp-methods
- '("nc"
+ `("nc"
(tramp-login-program "telnet")
(tramp-login-args (("%h") ("%p") ("2>/dev/null")))
- (tramp-remote-shell "/bin/sh")
+ (tramp-remote-shell ,tramp-default-remote-shell)
(tramp-remote-shell-login ("-l"))
(tramp-remote-shell-args ("-c"))
(tramp-copy-program "nc")
;; We use "-p" as required for newer busyboxes. For older
;; busybox/nc versions, the value must be (("-l") ("%r")). This
;; can be achieved by tweaking `tramp-connection-properties'.
- (tramp-remote-copy-args (("-l") ("-p" "%r") ("2>/dev/null")))))
+ (tramp-remote-copy-args (("-l") ("-p" "%r")
+ ("2>/dev/null")))))
(add-to-list 'tramp-methods
- '("su"
+ `("su"
(tramp-login-program "su")
(tramp-login-args (("-") ("%u")))
- (tramp-remote-shell "/bin/sh")
+ (tramp-remote-shell ,tramp-default-remote-shell)
(tramp-remote-shell-login ("-l"))
(tramp-remote-shell-args ("-c"))
(tramp-connection-timeout 10)))
(add-to-list 'tramp-methods
- '("sg"
+ `("sg"
(tramp-login-program "sg")
(tramp-login-args (("-") ("%u")))
- (tramp-remote-shell "/bin/sh")
+ (tramp-remote-shell ,tramp-default-remote-shell)
(tramp-remote-shell-args ("-c"))
(tramp-connection-timeout 10)))
(add-to-list 'tramp-methods
- '("sudo"
+ `("sudo"
(tramp-login-program "sudo")
;; The password template must be masked. Otherwise,
;; it could be interpreted as password prompt if the
("-p" "P\"\"a\"\"s\"\"s\"\"w\"\"o\"\"r\"\"d\"\":")))
;; Local $SHELL could be a nasty one, like zsh or
;; fish. Let's override it.
- (tramp-login-env (("SHELL") ("/bin/sh")))
- (tramp-remote-shell "/bin/sh")
+ (tramp-login-env (("SHELL")
+ (,tramp-default-remote-shell)))
+ (tramp-remote-shell ,tramp-default-remote-shell)
(tramp-remote-shell-login ("-l"))
(tramp-remote-shell-args ("-c"))
(tramp-connection-timeout 10)
(tramp-session-timeout 300)))
(add-to-list 'tramp-methods
- '("doas"
+ `("doas"
(tramp-login-program "doas")
(tramp-login-args (("-u" "%u") ("-s")))
- (tramp-remote-shell "/bin/sh")
+ (tramp-remote-shell ,tramp-default-remote-shell)
(tramp-remote-shell-args ("-c"))
(tramp-connection-timeout 10)
(tramp-session-timeout 300)))
(add-to-list 'tramp-methods
- '("ksu"
+ `("ksu"
(tramp-login-program "ksu")
(tramp-login-args (("%u") ("-q")))
- (tramp-remote-shell "/bin/sh")
+ (tramp-remote-shell ,tramp-default-remote-shell)
(tramp-remote-shell-login ("-l"))
(tramp-remote-shell-args ("-c"))
(tramp-connection-timeout 10)))
(add-to-list 'tramp-methods
- '("krlogin"
+ `("krlogin"
(tramp-login-program "krlogin")
(tramp-login-args (("%h") ("-l" "%u") ("-x")))
- (tramp-remote-shell "/bin/sh")
+ (tramp-remote-shell ,tramp-default-remote-shell)
(tramp-remote-shell-login ("-l"))
(tramp-remote-shell-args ("-c"))))
(add-to-list 'tramp-methods
`("plink"
(tramp-login-program "plink")
- (tramp-login-args (("-l" "%u") ("-P" "%p") ("-ssh") ("-t")
- ("%h") ("\"")
+ (tramp-login-args (("-l" "%u") ("-P" "%p") ("-ssh")
+ ("-t") ("%h") ("\"")
(,(format
"env 'TERM=%s' 'PROMPT_COMMAND=' 'PS1=%s'"
tramp-terminal-type
tramp-initial-end-of-output))
- ("/bin/sh") ("\"")))
- (tramp-remote-shell "/bin/sh")
+ ("%l") ("\"")))
+ (tramp-remote-shell ,tramp-default-remote-shell)
(tramp-remote-shell-login ("-l"))
(tramp-remote-shell-args ("-c"))))
(add-to-list 'tramp-methods
"env 'TERM=%s' 'PROMPT_COMMAND=' 'PS1=%s'"
tramp-terminal-type
tramp-initial-end-of-output))
- ("/bin/sh") ("\"")))
- (tramp-remote-shell "/bin/sh")
+ ("%l") ("\"")))
+ (tramp-remote-shell ,tramp-default-remote-shell)
(tramp-remote-shell-login ("-l"))
(tramp-remote-shell-args ("-c"))))
(add-to-list 'tramp-methods
`("pscp"
(tramp-login-program "plink")
- (tramp-login-args (("-l" "%u") ("-P" "%p") ("-ssh") ("-t")
- ("%h") ("\"")
+ (tramp-login-args (("-l" "%u") ("-P" "%p") ("-ssh")
+ ("-t") ("%h") ("\"")
(,(format
"env 'TERM=%s' 'PROMPT_COMMAND=' 'PS1=%s'"
tramp-terminal-type
tramp-initial-end-of-output))
- ("/bin/sh") ("\"")))
- (tramp-remote-shell "/bin/sh")
+ ("%l") ("\"")))
+ (tramp-remote-shell ,tramp-default-remote-shell)
(tramp-remote-shell-login ("-l"))
(tramp-remote-shell-args ("-c"))
(tramp-copy-program "pscp")
- (tramp-copy-args (("-l" "%u") ("-P" "%p") ("-scp") ("-p" "%k")
- ("-q") ("-r")))
+ (tramp-copy-args (("-l" "%u") ("-P" "%p") ("-scp")
+ ("-p" "%k") ("-q") ("-r")))
(tramp-copy-keep-date t)
(tramp-copy-recursive t)))
(add-to-list 'tramp-methods
`("psftp"
(tramp-login-program "plink")
- (tramp-login-args (("-l" "%u") ("-P" "%p") ("-ssh") ("-t")
- ("%h") ("\"")
+ (tramp-login-args (("-l" "%u") ("-P" "%p") ("-ssh")
+ ("-t") ("%h") ("\"")
(,(format
"env 'TERM=%s' 'PROMPT_COMMAND=' 'PS1=%s'"
tramp-terminal-type
tramp-initial-end-of-output))
- ("/bin/sh") ("\"")))
- (tramp-remote-shell "/bin/sh")
+ ("%l") ("\"")))
+ (tramp-remote-shell ,tramp-default-remote-shell)
(tramp-remote-shell-login ("-l"))
(tramp-remote-shell-args ("-c"))
(tramp-copy-program "pscp")
- (tramp-copy-args (("-l" "%u") ("-P" "%p") ("-sftp") ("-p" "%k")
- ("-q")))
+ (tramp-copy-args (("-l" "%u") ("-P" "%p") ("-sftp")
+ ("-p" "%k") ("-q")))
(tramp-copy-keep-date t)))
(add-to-list 'tramp-methods
- '("fcp"
+ `("fcp"
(tramp-login-program "fsh")
(tramp-login-args (("%h") ("-l" "%u") ("sh" "-i")))
- (tramp-remote-shell "/bin/sh")
+ (tramp-remote-shell ,tramp-default-remote-shell)
(tramp-remote-shell-login ("-l"))
(tramp-remote-shell-args ("-i") ("-c"))
(tramp-copy-program "fcp")
while (read STDIN, $data, 54) {
my $pad = q();
- # Only for the last chunk, and only if did not fill the last three-byte packet
+ # Only for the last chunk, and only if did not fill the last
+ # three-byte packet
if (eof) {
my $mod = length($data) %% 3;
$pad = q(=) x (3 - $mod) if $mod;
vec 'file-error "Couldn't find command to check if file exists"))
result))
+(defun tramp-get-sh-extra-args (shell)
+ "Find extra args for SHELL."
+ (let ((alist tramp-sh-extra-args)
+ item extra-args)
+ (while (and alist (null extra-args))
+ (setq item (pop alist))
+ (when (string-match-p (car item) shell)
+ (setq extra-args (cdr item))))
+ extra-args))
+
(defun tramp-open-shell (vec shell)
"Opens shell SHELL."
(with-tramp-progress-reporter
vec 5 (format-message "Opening remote shell `%s'" shell)
;; Find arguments for this shell.
- (let ((alist tramp-sh-extra-args)
- item extra-args)
- (while (and alist (null extra-args))
- (setq item (pop alist))
- (when (string-match-p (car item) shell)
- (setq extra-args (cdr item))))
- ;; It is useful to set the prompt in the following command
- ;; because some people have a setting for $PS1 which /bin/sh
+ (let ((extra-args (tramp-get-sh-extra-args shell)))
;; doesn't know about and thus /bin/sh will display a strange
;; prompt. For example, if $PS1 has "${CWD}" in the value, then
;; ksh will display the current working directory but /bin/sh
(tramp-get-method-parameter hop 'tramp-login-program))
(login-args
(tramp-get-method-parameter hop 'tramp-login-args))
+ (remote-shell
+ (tramp-get-method-parameter hop 'tramp-remote-shell))
+ (extra-args (tramp-get-sh-extra-args remote-shell))
(login-env
(tramp-get-method-parameter hop 'tramp-login-env))
(async-args
spec (format-spec-make ?t tmpfile)
options (format-spec options spec)
spec (format-spec-make
- ?h l-host ?u l-user ?p l-port ?c options)
+ ?h l-host ?u l-user ?p l-port ?c options
+ ?l (concat remote-shell " " extra-args))
command
(concat
;; We do not want to see the trailing local
(progn
(tramp-message
vec 3
- "`getconf PATH' not successful, using default value \"%s\"."
+ "`getconf PATH' not successful, using default value \"%s\"."
"/bin:/usr/bin")
"/bin:/usr/bin"))))
(own-remote-path
;; way of passing credentials, like by using an SSL socket or
;; something. (David Kastrup)
;;
-;; * Reconnect directly to a compliant shell without first going
-;; through the user's default shell. (Pete Forman)
-;;
;; * Avoid the local shell entirely for starting remote processes. If
;; so, I think even a signal, when delivered directly to the local
;; SSH instance, would correctly be propagated to the remote process
* `tramp-login-args'
This specifies the list of arguments to pass to the above
- mentioned program. Please note that this is a list of list of arguments,
- that is, normally you don't want to put \"-a -b\" or \"-f foo\"
- here. Instead, you want a list (\"-a\" \"-b\"), or (\"-f\" \"foo\").
- There are some patterns: \"%h\" in this list is replaced by the host
- name, \"%u\" is replaced by the user name, \"%p\" is replaced by the
- port number, and \"%%\" can be used to obtain a literal percent character.
- If a list containing \"%h\", \"%u\" or \"%p\" is unchanged during
- expansion (i.e. no host or no user specified), this list is not used as
- argument. By this, arguments like (\"-l\" \"%u\") are optional.
- \"%t\" is replaced by the temporary file name produced with
- `tramp-make-tramp-temp-file'. \"%k\" indicates the keep-date
- parameter of a program, if exists. \"%c\" adds additional
- `tramp-ssh-controlmaster-options' options for the first hop.
- The existence of `tramp-login-args', combined with the absence of
- `tramp-copy-args', is an indication that the method is capable of
- multi-hops.
+ mentioned program. Please note that this is a list of list
+ of arguments, that is, normally you don't want to put \"-a
+ -b\" or \"-f foo\" here. Instead, you want a list (\"-a\"
+ \"-b\"), or (\"-f\" \"foo\"). There are some patterns:
+
+ - \"%h\" in this list is replaced by the host name
+ - \"%u\" is replaced by the user name
+ - \"%p\" is replaced by the port number
+ - \"%%\" can be used to obtain a literal percent character.
+
+ If a list containing \"%h\", \"%u\" or \"%p\" is unchanged
+ during expansion (i.e. no host, no user or no port
+ specified), this list is not used as argument. By this,
+ arguments like (\"-l\" \"%u\") are optional.
+
+ - \"%l\" is replaced by the login shell `tramp-remote-shell'
+ and its parameters.
+ - \"%t\" is replaced by the temporary file name produced with
+ `tramp-make-tramp-temp-file'.
+ - \"%k\" indicates the keep-date parameter of a program, if exists
+ - \"%c\" adds additional `tramp-ssh-controlmaster-options'
+ options for the first hop.
+
+ The existence of `tramp-login-args', combined with the
+ absence of `tramp-copy-args', is an indication that the
+ method is capable of multi-hops.
* `tramp-login-env'
A list of environment variables and their values, which will
Notes:
+All these arguments can be overwritten by connection properties.
+See Info node `(tramp) Predefined connection information'.
+
When using `su' or `sudo' the phrase \"open connection to a remote
host\" sounds strange, but it is used nevertheless, for consistency.
No connection is opened to a remote host, but `su' or `sudo' is