From 45097ec5b3a0c06778bdba2ffba81cd6d7fa8a76 Mon Sep 17 00:00:00 2001 From: rekado Date: Thu, 14 Jul 2016 12:42:53 +0200 Subject: Add configuration for TRAMP. --- init.org | 35 +++++++++++++++++++++++++++++++++++ old-init.el | 28 ++++++---------------------- 2 files changed, 41 insertions(+), 22 deletions(-) diff --git a/init.org b/init.org index 0b7cee8..ce160f7 100644 --- a/init.org +++ b/init.org @@ -369,6 +369,40 @@ All of this should be loaded lazily. (require 'org) #+END_SRC +* Editing files on remote systems +:PROPERTIES: +:noweb-ref: tramp +:END: + +TRAMP is a really convenient way to edit files on remote systems from +within the comfort of my cozy customised local Emacs session. I use +it to edit files at work, to edit things on my server =elephly.net=, +and even to edit things as root on the local system. + +#+BEGIN_SRC elisp +(require 'tramp) +(setq tramp-default-method "ssh") + +(setq tramp-default-proxies-alist + (list + ;; Do not use a proxy on the same system. + '((regexp-quote (system-name)) nil nil) + ;; For root connections to remote hosts, log in via ssh with normal + ;; user account first, then su/sudo to root + '("elephly\\.net\\'" "\\`root\\'" "/ssh:%h:") + ;; Pass through ssh1 as user ‘rwurmus’ to reach remote hosts on + ;; MDC network. + '("mdc-berlin\\.net" "\\`rwurmus\\'" "/ssh:rwurmus@ssh1.mdc-berlin.de:"))) + +;; ssh1 runs a restricted shell session, so "exec ssh" cannot be used. +(add-to-list 'tramp-restricted-shell-hosts-alist + "\\`ssh1\\.mdc-berlin\\.de\\'") + +;; respect the PATH variable on the remote machine +(add-to-list 'tramp-remote-path 'tramp-own-remote-path) +(setq tramp-verbose 3) +#+END_SRC + * Shell :PROPERTIES: :noweb-ref: shell @@ -454,6 +488,7 @@ put them all together to build the init file <> <> <> +<> <> <> <> diff --git a/old-init.el b/old-init.el index 669b507..7816a13 100644 --- a/old-init.el +++ b/old-init.el @@ -1,26 +1,10 @@ -(require 'tramp) -(setq tramp-default-method "ssh") - -;; for root connections to remote hosts, log in via ssh with normal -;; user account first, then su/sudo to root -(add-to-list 'tramp-default-proxies-alist - '(nil "\\`root\\'" "/ssh:%h:")) -(add-to-list 'tramp-default-proxies-alist - '((regexp-quote (system-name)) nil nil)) - -;; respect the PATH variable on the remote machine -(add-to-list 'tramp-remote-path 'tramp-own-remote-path) - -;; Backup (file~) disabled and auto-save (#file#) locally to prevent delays in editing remote files -(add-to-list 'backup-directory-alist - (cons tramp-file-name-regexp nil)) -(setq tramp-auto-save-directory temporary-file-directory) -(setq tramp-verbose 3) - -;; Write backup files to own directory -;; TODO: conflicts with previous manipulation of backup-directory-alist + + (setq backup-directory-alist - `(("." . ,(expand-file-name + `(;; Do not backup or auto-save remote files to prevent delays. + (tramp-file-name-regexp . nil) + ;; Write backup files to a dedicated directory. + ("." . ,(expand-file-name (concat user-emacs-directory "backups"))))) ;; Make backups of files, even when they're in version control -- cgit v1.2.3