Live data from Hacker News

SSH Examples, Tips and Tunnels

hackertarget.com

1–10 of 72 posts

Re: SSH Examples, Tips and Tunnels

#2
> localhost:~$ ssh remoteserver "cat /var/log/nginx/access.log" | grep badstuff.php

It would be much more traffic (and execution time) friendly, if you put pipe and grep to "" as well, so grep would be executed on remote server and ssh won't have to send the entire log to your machine.

And I'd like to highlight the overwhelming awesomeness of ~/.ssh/config file. If you haven't heard about it or use shell alias instead please please read about it. It supports autocomplete, dynamic paths to key files and many other cool things which can make your ssh client experience simply great.

Re: SSH Examples, Tips and Tunnels

#5
There is a windows program named sshfs-win[1] that allows mounting of remote SSH location as local folders and SiriKali[2] is currently its only GUI frontend. SiriKali also supports sshfs on Linux.

[1] https://github.com/billziss-gh/sshfs-win

[2] https://mhogomchungu.github.io/sirikali

Re: SSH Examples, Tips and Tunnels

#6
post #2

> localhost:~$ ssh remoteserver "cat /var/log/nginx/access.log" | grep badstuff.php It would be much more traffic (and execution time) friendly, if you put pipe and grep to "" as well, so grep would be executed on remote server and ssh won't have to send the entire log to your machine. And I'd like to highlight the overwhelming awesomeness of ~/.ssh/config file. If you haven't heard about it or use shell alias instea…

The article does touch on that optimization:

In this example the grep is being performed on the local system after the log file has been pushed across the ssh session. If the file is large it would be more efficient to run the grep on the remote side simply by enclosing the pipe and grep in the double quotes.

Re: SSH Examples, Tips and Tunnels

#7
post #3

Gah, just yesterday I had this crazy problem with SSH tunnels and psql (Postgres client) crashing the tunnel. What solved it? Changing my interface MTU... http://www.snailbook.com/faq/mtu-mismatch.auto.html

This is interesting. I sometimes have to connect to a VPN that crashes when something provokes a burst of activity (if I cat a file or even ls a large dir). I'll try this, but 576 seems so low; how did you get at this number?

Re: SSH Examples, Tips and Tunnels

#8
post #7
post #3

Gah, just yesterday I had this crazy problem with SSH tunnels and psql (Postgres client) crashing the tunnel. What solved it? Changing my interface MTU... http://www.snailbook.com/faq/mtu-mismatch.auto.html

This is interesting. I sometimes have to connect to a VPN that crashes when something provokes a burst of activity (if I cat a file or even ls a large dir). I'll try this, but 576 seems so low; how did you get at this number?

This is what I want to know - the article doesn't explain. I guess its a number that particular (old?) routers / particular firewalls won't fragment the packet..?

Re: SSH Examples, Tips and Tunnels

#9
post #2

> localhost:~$ ssh remoteserver "cat /var/log/nginx/access.log" | grep badstuff.php It would be much more traffic (and execution time) friendly, if you put pipe and grep to "" as well, so grep would be executed on remote server and ssh won't have to send the entire log to your machine. And I'd like to highlight the overwhelming awesomeness of ~/.ssh/config file. If you haven't heard about it or use shell alias instea…

> .ssh/config

Do you mean this or something not described there?

https://nerderati.com/2011/03/17/simplify-your-life-with-an-...

Re: SSH Examples, Tips and Tunnels

#10
Is the first "Using a Configuration File" example a bit misleading? The example is:

... Host remoteserver HostName remoteserver.thematrix.io User neo Port 2112 IdentityFile /home/test/.ssh/remoteserver.pub

IdentityFile typically (always?) specifies a file with a private key, right?

Post reply on HN