2

I'm relatively new to tramp and despite being certain that it offers an elegant solution to my needs, I wasn't able to find one thus far. Let me briefly describe my workflow:

I connect to a server via tramp via ssh:user@host:path/ and there I usually edit a given text file. Commonly I have to upload a new document to the same file from my local machine. To achieve this, I (and this is the part I want to fix) open a separate eshell buffer in emacs and copy the file via scp to user@host:path/ . I then (which - again - is very undesirable) use this eshell buffer to connect (via ssh) a third time to the server to change the permissions of this newly uploaded file.

Clearly, this workflow is ridiculously inefficient and in desperate need of improvement. Can someone help?


I'd also like to disclaim that I searched for relevant questions on this side and found

However, I wasn't able to derive an answer of my question from them - probably due to the lacking knowledge on my part.

Stefan Mesken
  • 245
  • 1
  • 6
  • Could you clarify your specific question? It's very open-ended right now. – Dan Jul 03 '16 at 16:32
  • @Dan I'm not sure how to narrow it, because I don't know exactly which solution I'm looking for. I'd like to find an efficient way to both edit text files on a given server and copy files from my local machine to it in emacs - preferably using tramp. – Stefan Mesken Jul 03 '16 at 17:05

1 Answers1

2

For copying files from the local to the remote machine or vice-versa, I connect to the remote machine with tramp: C-x d /ssh:user@host:/path/of/remote/dir I have the window split in two, on one side the local dired buffer and on the other side the remote one. So, I use dired-do-copy from dired-aux package.

Edit: forgot to add as phils suggested, you havet to set dired-dwin-target:

(setq dired-dwim-target t)
caisah
  • 4,056
  • 1
  • 23
  • 43
  • How do I open dired in an ssh session? – Stefan Mesken Jul 03 '16 at 17:03
  • Stefan: Exactly the same way as you open dired for *any* directory. Just use the tramp path. (Or use `C-x d` from your remote file buffer.) – phils Jul 03 '16 at 21:54
  • 1
    I recommend setting `(setq dired-dwim-target t)`, which makes copying files between dired buffers easier, as the suggested default target directory will automatically be that of the other dired buffer. – phils Jul 03 '16 at 21:56
  • @phils Thanks, I forgot about that. I have updated my answer. – caisah Jul 04 '16 at 07:35