* doc/misc/tramp.texi (Inline methods): Add "sg" method.
(Customizing Completion): Add function `tramp-parse-etc-group'.
* lisp/net/tramp-sh.el (tramp-methods) <sg>: Add. (Bug#22329)
(tramp-completion-function-alist-sg): New defconst.
(top): Completion function for "sg" is
`tramp-completion-function-alist-sg'.
* lisp/net/tramp.el (tramp-completion-function-alist): Adapt docstring.
(tramp-parse-etc-group, tramp-parse-etc-group-group): New defuns.
@command{rsh} is an option for connecting to hosts within local
networks since @command{rsh} is not as secure as other methods.
-
@item @option{ssh}
@cindex method ssh
@cindex ssh method
Connecting to a remote host with @command{telnet} is as insecure
as the @option{rsh} method.
-
@item @option{su}
@cindex method su
@cindex su method
Similar to @option{su} method, @option{sudo} uses @command{sudo}.
@command{sudo} must have sufficient rights to start a shell.
+@item @option{sg}
+@cindex method sg
+@cindex sg method
+
+The @command{sg} program allows editing as different group. The host
+can be either @samp{localhost} or the host returned by the function
+@command{(system-name)}. The user name must be specified, but it
+denotes a group name. See @ref{Multi-hops} for an exception to this
+behavior.
+
@item @option{sshx}
@cindex method sshx
@cindex sshx method
This is another method from the Kerberos suite. It behaves like @option{su}.
-
@item @option{plink}
@cindex method plink
@cindex plink method
@option{plink} method supports the @samp{-P} argument.
-
@item @option{plinkx}
@cindex method plinkx
@cindex plinkx method
This method supports the @samp{-p} argument.
-
@item @option{scpx}---@command{ssh} and @command{scp}
@cindex method scpx
@cindex scpx method
This method supports the @samp{-p} argument.
-
@item @option{pscp}---@command{plink} and @command{pscp}
@item @option{psftp}---@command{plink} and @command{psftp}
@cindex method pscp
These methods support the @samp{-P} argument.
-
@item @option{fcp}---@command{fsh} and @command{fcp}
@cindex method fcp
@cindex fcp method
ftp program is specified by Ange FTP. This external program must be
capable of servicing requests from @value{tramp}.
-
@item @option{smb}---@command{smbclient}
@cindex method smb
@cindex smb method
UNC file name specification does not allow to specify a different user
name for authentication like the @command{smbclient} can.
-
@item @option{adb}
@cindex method adb
@cindex adb method
OBEX is an FTP-like access protocol for cell phones and similar simple
devices. @value{tramp} supports OBEX over Bluetooth.
-
@item @option{sftp}
@cindex method sftp
@cindex sftp method
Authentication} (see RFC 2617). When no port number is specified, this
protocol defaults to @option{8080}.
-
@item @option{socks}
@cindex method socks
@cindex socks method
A function which parses @file{/etc/passwd} files for user names.
+@item @code{tramp-parse-etc-group}
+@findex tramp-parse-etc-group
+
+A function which parses @file{/etc/group} files for group names.
+
@item @code{tramp-parse-netrc}
@findex tramp-parse-netrc
*** The kqueue library is integrated for *BSD and Mac OS X machines.
+** Tramp
+
+*** New connection method "sg", which allows to edit files under
+different group ID.
+
\f
* New Modes and Packages in Emacs 25.2
(tramp-remote-shell-args ("-c"))
(tramp-connection-timeout 10)))
;;;###tramp-autoload
+(add-to-list
+ 'tramp-methods
+ '("sg"
+ (tramp-login-program "sg")
+ (tramp-login-args (("-") ("%u")))
+ (tramp-remote-shell "/bin/sh")
+ (tramp-remote-shell-args ("-c"))
+ (tramp-connection-timeout 10)))
+;;;###tramp-autoload
(add-to-list 'tramp-methods
'("sudo"
(tramp-login-program "sudo")
'((tramp-parse-passwd "/etc/passwd"))
"Default list of (FUNCTION FILE) pairs to be examined for su methods.")
+;;;###tramp-autoload
+(defconst tramp-completion-function-alist-sg
+ '((tramp-parse-etc-group "/etc/group"))
+ "Default list of (FUNCTION FILE) pairs to be examined for sg methods.")
+
;;;###tramp-autoload
(defconst tramp-completion-function-alist-putty
`((tramp-parse-putty
,(if (memq system-type '(windows-nt))
"HKEY_CURRENT_USER\\Software\\SimonTatham\\PuTTY\\Sessions"
"~/.putty/sessions")))
- "Default list of (FUNCTION REGISTRY) pairs to be examined for putty sessions.")
+ "Default list of (FUNCTION REGISTRY) pairs to be examined for putty sessions.")
;;;###tramp-autoload
(eval-after-load 'tramp
(tramp-set-completion-function "su" tramp-completion-function-alist-su)
(tramp-set-completion-function "sudo" tramp-completion-function-alist-su)
(tramp-set-completion-function "ksu" tramp-completion-function-alist-su)
+ (tramp-set-completion-function "sg" tramp-completion-function-alist-sg)
(tramp-set-completion-function
"krlogin" tramp-completion-function-alist-rsh)
(tramp-set-completion-function "plink" tramp-completion-function-alist-ssh)
;; rsync).
;; * Keep a second connection open for out-of-band methods like scp or
;; rsync.
+;; * Check, whether we could also use "getent passwd" and "getent
+;; group" for user/group name completion.
;;; tramp-sh.el ends here
* `tramp-parse-sknownhosts' for \"~/.ssh2/knownhosts/*\" like files,
* `tramp-parse-hosts' for \"/etc/hosts\" like files,
* `tramp-parse-passwd' for \"/etc/passwd\" like files.
+ * `tramp-parse-etc-group' for \"/etc/group\" like files.
* `tramp-parse-netrc' for \"~/.netrc\" like files.
* `tramp-parse-putty' for PuTTY registered sessions.
(defcustom tramp-password-prompt-regexp
(format "^.*\\(%s\\).*:\^@? *"
+ ;; `password-word-equivalents' has been introduced with Emacs 24.4.
(if (boundp 'password-word-equivalents)
(regexp-opt (symbol-value 'password-word-equivalents))
"password\\|passphrase"))
(forward-line 1)
result))
+;;;###tramp-autoload
+(defun tramp-parse-etc-group (filename)
+ "Return a list of (group host) tuples allowed to access.
+Host is always \"localhost\"."
+ (tramp-parse-file filename 'tramp-parse-etc-group-group))
+
+(defun tramp-parse-etc-group-group ()
+ "Return a (group host) tuple allowed to access.
+Host is always \"localhost\"."
+ (let ((result)
+ (split (split-string (buffer-substring (point) (point-at-eol)) ":")))
+ (when (member (user-login-name) (split-string (nth 3 split) "," 'omit))
+ (setq result (list (nth 0 split) "localhost")))
+ (forward-line 1)
+ result))
+
;;;###tramp-autoload
(defun tramp-parse-netrc (filename)
"Return a list of (user host) tuples allowed to access.