summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrekado <rekado@elephly.net>2016-07-14 12:42:53 +0200
committerrekado <rekado@elephly.net>2016-07-14 12:42:53 +0200
commit45097ec5b3a0c06778bdba2ffba81cd6d7fa8a76 (patch)
tree751b5b948403c02163da82884fa15a8c2bf55165
parent6ab9d76f276e35d35ba6d97f77fdf94693c433bd (diff)
Add configuration for TRAMP.
-rw-r--r--init.org35
-rw-r--r--old-init.el28
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
<<initial>>
<<packages>>
<<default-fonts>>
+<<tramp>>
<<shell>>
<<initial-after-packages>>
<<org-mode>>
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