zvi: self-portrait: short, fat, black dyke in bunny slippers (Default)
still kind of a stealthy love ninja ([personal profile] zvi) wrote in [site community profile] dw_dev_training2009-09-30 08:13 pm
Entry tags:

Extremely naive question about working with SSH

Okay, when I have a patchfile on my dreamhack, how do I get it out of my dreamhack?

That is to say, when people have asked me to pastebin a file to them, I've been running less on the file, copying each screen, and adding them all together until they make the whole file and then posting it to pastebin.

I know this doesn't transfer files with 100% accuracy to pastebin, but it's usually good enough. However, there has to be a better way to get a file off the dreamhack and onto my local computer, so I can upload it to bugzilla. I just can't, for the life of me, figure out what that better way might be.
mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)

[staff profile] mark 2009-10-01 12:31 am (UTC)(link)
There's a bunch of ways of doing it. What I tend to do, because I'm a lazy guy and it's so easy, is just copy it to htdocs for a moment. Assuming the file is named foo.patch, you can just do,

$ cp foo.patch htdocs/foo.txt

Then go to the file in your browser:

http://your hack address.com/foo.txt

When you're done, you can remove it with rm. Note that naming the file ".txt" allows you to pull it up easily in your browser. If it doesn't haven't an extension, or has .patch or .diff or something else, your browser won't display it and will ask if you want to download the file.
sophie: A cartoon-like representation of a girl standing on a hill, with brown hair, blue eyes, a flowery top, and blue skirt. ☀ (Default)

[personal profile] sophie 2009-10-01 12:40 am (UTC)(link)
Another way you can do it, as well as Mark's method above, is to use a program like WinSCP (if you're using Windows) or some other program that can browse SFTP. That'll let you download things onto your computer.
sophie: A cartoon-like representation of a girl standing on a hill, with brown hair, blue eyes, a flowery top, and blue skirt. ☀ (Default)

[personal profile] sophie 2009-10-01 10:51 am (UTC)(link)
Ah, right. I use Linux too as my main OS, but I just assume most people don't. ;p

I don't use sshfs as suggested by some commenters, mostly because I'd probably forget to unmount it or something and then if I mounted it in the wrong place updatedb would start indexing it next morning. ;p What I actually tend to do is either scp or a combination of ssh+tar, such as:

ssh dh-sophie@hack.dreamwidth.net "cd somedir; tar zc *" | tar zxv

I do this when I need to transfer multiple files. since I've found scp to be abysmally slow at that, if there are a lot of files, even with compression on.

Hope that helps. :)
hypatia: (Default)

[personal profile] hypatia 2009-10-01 01:49 am (UTC)(link)
looks like winscp is your best bet - if you right-click on a file and choose "edit" it will even open it right off the server without you needing to save it locally, so you can just ctrl-a to select all and copy and paste :)
hypatia: (Default)

[personal profile] hypatia 2009-10-01 05:20 am (UTC)(link)
ahh! sorry for assuming :)

as mentioned below, sshfs is teh awesome. if you're running a gnome desktop, you can also go to places -- connect to server and add it there.
gchick: Small furry animal wearing a tin-foil hat (Default)

[personal profile] gchick 2009-10-01 02:29 am (UTC)(link)
If you're working in Linux (which I think I remember you are, at least some of the time?) sshfs is made of unadulterated awesome. It works by mounting any site you can SSH to as a local volume, so you can not only edit on the server but treat your hack files just like local ones when it comes to things like browsing for them to upload through a browser.
mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)

[staff profile] mark 2009-10-01 03:51 am (UTC)(link)
I have never seen this sshfs, but woah, want! :O
yvi: Kaylee half-smiling, looking very pretty (Default)

[personal profile] yvi 2009-10-01 07:28 am (UTC)(link)
I am finding sshfs rather slow, actually. For most things, I just use scp.
afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)

[personal profile] afuna 2009-10-01 09:23 am (UTC)(link)
Same for me, but it sounds really amazing for people with better internet connections *g*
yvi: Kaylee half-smiling, looking very pretty (Default)

[personal profile] yvi 2009-10-01 09:25 am (UTC)(link)
I find that a bit surprising, since my internet connection *is* very good.

Maybe standards of that vary around the world, but I don't usually have any problems with speed, so I was very confused by how slow sshfs was working for me - changing directories was quite painful.
whobutdrew: (Rational)

[personal profile] whobutdrew 2009-10-02 10:40 pm (UTC)(link)
While certainly not tech-flashy, when I'm working on ssh, I can use Ctrl-C to copy what is highlighted (it also kills whatever prog I'm in, unless its vim) and can then paste it into Windows. Going the othre way is easier - right-clicking in ssh pastes whats on the clipboard. Make sure you are already in Edit mode in vim, though.

Not as shiny as SCP or the like, but its quick and dirty.
pne: A picture of a plush toy, halfway between a duck and a platypus, with a green body and a yellow bill and feet. (Default)

[personal profile] pne 2009-10-05 11:15 am (UTC)(link)
Make sure you are already in Edit mode in vim, though.

It may also help to :set paste before pasting (and optionally :set nopaste afterwards), otherwise you might get vim's auto-indenting screwing with your already-indented code.