{"id":423,"date":"2012-10-10T08:46:00","date_gmt":"2012-10-10T06:46:00","guid":{"rendered":"http:\/\/www.b.shuttle.de\/hayek\/Hayek\/Jochen\/wp\/blog-en\/2012\/10\/10\/emacs-putty-tramp-you-can-edit-your-unix-files-remotely-on-windows\/"},"modified":"2022-08-09T10:41:01","modified_gmt":"2022-08-09T08:41:01","slug":"emacs-putty-tramp-you-can-edit-your-unix-files-remotely-on-windows","status":"publish","type":"post","link":"https:\/\/wp.jochen.hayek.name\/blog-en\/2012\/10\/10\/emacs-putty-tramp-you-can-edit-your-unix-files-remotely-on-windows\/","title":{"rendered":"Emacs + tramp + putty = you can edit your UNIX files remotely &#8220;anywhere&#8221;, even on Windows"},"content":{"rendered":"\n<ul class=\"wp-block-list\"><li><a href=\"http:\/\/www.gnu.org\/software\/tramp\/\">http:\/\/www.gnu.org\/software\/tramp\/<\/a><\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">TRAMP extends the capabilities of the emacs &#8220;<i>directory editor<\/i>&#8221; (<i>dired<\/i>) to allow you to also deal with remote files. &#8220;Remote&#8221; as in:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>you can reach the file or directory through <i>ssh<\/i><\/li><li>or <i>sftp<\/i><\/li><li>or <i>ftp<\/i><\/li><li>or \u2026<\/li><\/ul>\n\n\n\n<div><b>SSH on Windows \u2013 PuTTY<\/b>:<br>On Windows platforms it can make use of the PuTTY family of utilities in order to achieve <i>ssh<\/i> and <i>sftp<\/i> tasks.<\/div>\n\n\n\n<div>&nbsp;<\/div>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"http:\/\/www.gnu.org\/software\/tramp\/#Default-Method\">http:\/\/www.gnu.org\/software\/tramp\/#Default-Method<\/a><\/li><li><a href=\"https:\/\/www.emacswiki.org\/emacs\/Tramp_on_Windows\">https:\/\/www.emacswiki.org\/emacs\/Tramp_on_Windows<\/a><\/li><\/ul>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">(setq tramp-default-method &#8220;pscp&#8221;)<\/p>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">I personally chose <em>pscp<\/em> to be my <em>tramp-default-method<\/em>&nbsp;on Windows with PuTTY, I &#8220;customised&#8221; it (so I don&#8217;t really do a setq as show above), and the resp. setting lives in my&nbsp;<em>.emacs.d\/gnu-emacs-custom.el<\/em> .<\/p>\n\n\n\n<div>\u2026 According to my experience (having tried various ways resp. methods) <i>plink<\/i> resp. <i>plinkx<\/i> occasionally corrupt files, and you avoid that using <i>the TRAMP method pscp<\/i>, which is actually a nice combination of <i>plinkx<\/i> and <i>PuTTY pscp<\/i> (??? looks weird !!!), i.e. you are passing a named saved session (\u2192 PuTTY) rather than a host name to it. (&#8220;THE manual&#8221; does not mention this bit, but you should be aware of it.)<\/div>\n\n\n\n<div>&nbsp;<\/div>\n\n\n\n<div>\n<p>If you are able to add\u00a0the PuTTY installation directory to the %Path% environment variable, this makes things easy, otherwise\u00a0do it\u00a0within your\u00a0.emacs.d\/init.el !<\/p>\n<p>This also shows how to add the PuTTY directory to PATH (within .emacs.d\/init.el):<\/p>\n<ul>\n<li><a href=\"https:\/\/www.emacswiki.org\/emacs\/Tramp_on_Windows\">https:\/\/www.emacswiki.org\/emacs\/Tramp_on_Windows<\/a><\/li>\n<\/ul>\n<p>\u00a0<\/p>\n<p>Update 2013-01-15: <b>tramp paths with ports<\/b>:<br \/>Occasionally &#8220;sitting&#8221; on a VM (VirtualBox) host I copy \/ access files living in a VM Linux guest, whose SSH port is forwarded to the VM host&#8217;s port 2222.<br \/>VM-host $ env RSYNC_RSH=&#8217;ssh -p 2222&#8242; rsync -vaz diary localhost:diary_<br \/>This is a useful emacs\/tramp access path for those files:<br \/>\/scpx:localhost#2222:diary<\/p>\n<p><i>scpx<\/i> and <i>sshx<\/i> as opposed to <i>scp<\/i> and <i>ssh<\/i>\u00a0(without the &#8216;x&#8217; in the end) seem to accept a port number within these emacs\/tramp access paths.<\/p>\n<p>Update 2013-04-30:\u00a0problem with preserving emacs tramp file permissions:<br \/>Somebody else experiences this problem as well [<a href=\"http:\/\/comments.gmane.org\/gmane.emacs.tramp\/8107\">link<\/a>].<\/p>\n<p>Update 2013-04-30 evening:<br \/>http:\/\/www.chiark.greenend.org.uk\/~sgtatham\/putty\/wishlist\/pscp-filemodes.html : I think, this doesn&#8217;t concern TRAMP, as TRAMP has its own means to enquire and set file modes.<\/p>\n<p>Update 2013-10-__:<br \/>Found &#8220;vc-handled-backends&#8221; and reduced it on my Windows emacs \/ tramp \/ putty platform.<\/p>\n<p>Update 2017-09-08: Every now and then I come across this error message:<\/p>\n<blockquote>\n<p>Cannot find local copy program: pscp<\/p>\n<\/blockquote>\n<p>This only occurs for &#8220;bigger&#8221; files (e.g. a 40k file), not for small files, because small files are being dealt with by plink.<\/p>\n<p>tramp-do-copy-or-rename-file-out-of-band (in lisp\/net\/tramp-sh.el) tries to find the copy-program on <em>exec-path<\/em> instead of <em>PATH<\/em>, so we have to add putty-directory to exec-path as well. I amended this page to deal with the situation:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.emacswiki.org\/emacs\/Tramp_on_Windows\">https:\/\/www.emacswiki.org\/emacs\/Tramp_on_Windows<\/a><\/li>\n<\/ul>\n<p>Fixed\u00a0 \ud83d\ude06<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>http:\/\/www.gnu.org\/software\/tramp\/ TRAMP extends the capabilities of the emacs &#8220;directory editor&#8221; (dired) to allow you to also deal with remote files. &#8220;Remote&#8221; as in: you can reach the file or directory through ssh or sftp or ftp or \u2026 SSH on Windows \u2013 PuTTY:On Windows platforms it can make use of the PuTTY family of utilities [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false,"_share_on_mastodon":"0"},"categories":[120,475,666],"tags":[1359],"class_list":["post-423","post","type-post","status-publish","format-standard","hentry","category-emacs","category-putty","category-uncategorized","tag-tramp"],"share_on_mastodon":{"url":"","error":""},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/paO0kP-6P","jetpack_likes_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/posts\/423","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/comments?post=423"}],"version-history":[{"count":2,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/posts\/423\/revisions"}],"predecessor-version":[{"id":12155,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/posts\/423\/revisions\/12155"}],"wp:attachment":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/media?parent=423"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/categories?post=423"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/tags?post=423"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}