Live data from Hacker News

SSH Examples, Tips and Tunnels

hackertarget.com

61–70 of 72 posts

Re: SSH Examples, Tips and Tunnels

#61

Is there a way to combine screen/tmux with ssh ? like i always need to do some long running tasks over ssh and forget to put it in a screen session, i would like to open each ssh session in a screen session so that when i connect next i should be able to proceed from where i left

Pardon my ignorance. Why are screen/tmux so popular ? I just use a terminal with tabs (i.e. Gnome terminal)

screen/tmux persist when you log out. Let's say you have 10 shells open to a remote server in screen session and you reboot you client computer. If you ssh back into the remote and run screen...pow, you have your 10 shells back.

Re: SSH Examples, Tips and Tunnels

#62

If you liked this article, PLEASE, PLEASE just take 10 minutes to look at the manpages for ssh(1) and ssh_config(5). SSH options are nothing we need to research about, we humans made it and we wrote documentation for it. The manpages are also exhaustive, definitive, and valid for the exact version you have installed. Please, instead of making more 'how to use SSH'-articles popular, read the manpages yourself. Reading…

manpages are such an inconsistent and often wildly disappointing experience that I advise everyone to give up on them and go with instead.

There are like a half dozen really good manpages I can think of, some others might as well be written in Mandarin

Re: SSH Examples, Tips and Tunnels

#63

Is there a way to combine screen/tmux with ssh ? like i always need to do some long running tasks over ssh and forget to put it in a screen session, i would like to open each ssh session in a screen session so that when i connect next i should be able to proceed from where i left

Pardon my ignorance. Why are screen/tmux so popular ? I just use a terminal with tabs (i.e. Gnome terminal)

In part because you can use screen/tmux over an ssh connection.

Re: SSH Examples, Tips and Tunnels

#64

If you liked this article, PLEASE, PLEASE just take 10 minutes to look at the manpages for ssh(1) and ssh_config(5). SSH options are nothing we need to research about, we humans made it and we wrote documentation for it. The manpages are also exhaustive, definitive, and valid for the exact version you have installed. Please, instead of making more 'how to use SSH'-articles popular, read the manpages yourself. Reading…

My usage of manpages would increase by orders of magnitude if I knew there were examples of actual working commands in the first page. Most of the time I am not looking for an obscure parameter, but my brain just has failed to take a note of the basic syntax of the command. So why not start ssh manpage with two simple examples, how to connect to a host with username and ssh key: ssh user@example.com ssh -i ~/.ssh/id_…

> My usage of manpages would increase by orders of magnitude if I knew there were examples of actual working commands in the first page.

Try adding ManKier as a custom search provider for Firefox or Chrome, it is online man pages beginning with TL;DR examples at the top of each web page, followed by the traditional man page entry below. Here is a fuller explanation with links to instructions for adding it to your browser: https://www.mankier.com/about

I use it almost exclusively now, and only refer to my distro's man page in a terminal if I need to check on something that isn't standardised (such as sed -i.bak or something like that).

Custom browser search is pretty handy, try adding a dictionary and map provider too, or 'caniuse' if you do front-end work.

Re: SSH Examples, Tips and Tunnels

#65
post #54

Earlier quoted context omitted.

This is how every man page starts, with a "SYNOPSIS" of invocation. For example the ssh man page starts: ssh [-46AaCfGgKkMNnqsTtVvXxYy] [-B bind_interface] [-b bind_address] [-c cipher_spec] ... If there are several incompatible ways to invoke an operation several cases are given, e.g. netstat [-AaLlnW] [-f address_family | -p protocol] netstat [-gilns] [-v] [-f address_family] [-I interface] ... Typically there are…

Sorry, in my Ubuntu 18.04 "man ssh" produces output that does not have either EXAMPLES or USAGE. /^E takes me to ENVIRONMENT instrad of EXAMPLES.

Yes but as I mentioned in my comment for ssh there are several sections that each explain a different use case which you can jump to via /^[^ ]

Re: SSH Examples, Tips and Tunnels

#66
post #32
post #22

Earlier quoted context omitted.

Not the author but I find it easier to type folder than directory on qwerty. Not sure about other layout.

I don't think they are really interchangeable terms in this context, one is rigth the other one is wrong

macOS, GNOME, KDE, and Xfce use "folders".

Re: SSH Examples, Tips and Tunnels

#67
post #54

Earlier quoted context omitted.

This is how every man page starts, with a "SYNOPSIS" of invocation. For example the ssh man page starts: ssh [-46AaCfGgKkMNnqsTtVvXxYy] [-B bind_interface] [-b bind_address] [-c cipher_spec] ... If there are several incompatible ways to invoke an operation several cases are given, e.g. netstat [-AaLlnW] [-f address_family | -p protocol] netstat [-gilns] [-v] [-f address_family] [-I interface] ... Typically there are…

> ssh [-46AaCfGgKkMNnqsTtVvXxYy] [-B bind_interface] [-b bind_address] [-c cipher_spec] ... That's exactly the kind of "SYNOPSIS" would make me want to stomp on puppies when looking at a man page because I forgot some basic usage. But actually, thanks for the key-combo tip on jumping straight to examples.

Whereas it works great for me so that when I can’t remember the precise syntax I can just glance at the top of the man page; if I want anspecific option I can search for it.

Info format files are intended to be more comprehensive and tutorial but they never really made the jump to Unix.

Re: SSH Examples, Tips and Tunnels

#69
Nice post...covers some good use cases. I wrote a book all about SSH tunneling and port redirection use cases in depth...primarily for penetration testers. "The Cyber Plumber's Handbook" (https://cph.opsdisk.com/) is free (already given away 250+ copies) for students that have an educational/student email address. Simply send an email to cph-student@opsdisk.com and I'll send you a discount code to download it for free.

It walks you through the basics of SSH tunneling (both local and remote port forwards), SOCKS proxies, port redirection, and how to utilize them with other tools like proxychains, nmap, Metasploit, and web browsers.

Advanced topics included SSHing through 4 jump boxes, throwing exploits through SSH tunnels, scanning assets using proxychains and Metasploit's Meterpreter, browsing the Internet through a SOCKS proxy, utilizing proxychains and nmap to scan targets, and leveraging Metasploit's Meterpreter portfwd command.

Re: SSH Examples, Tips and Tunnels

#70
post #65

Earlier quoted context omitted.

Sorry, in my Ubuntu 18.04 "man ssh" produces output that does not have either EXAMPLES or USAGE. /^E takes me to ENVIRONMENT instrad of EXAMPLES.

Yes but as I mentioned in my comment for ssh there are several sections that each explain a different use case which you can jump to via /^[^ ]

Sorry, I am confused. In your comment you said that in case of ssh there are several EXAMPLES or USAGES sections. Well, in my case I find exactly zero instances regardless what kind of key combo from your comment I use.

If you instead meant that e.g. TCP FORWARDING or X11 FORWARDING are such sections that explain use cases, well, in that case I still fail to find a section that would describe simple use case of just connecting to a host.

Post reply on HN