5 ms·
SSH Cheat Sheet
- qwertox 4y agoI also find `ssh-copy-id` useful.
- peppermint_tea 4y agoa few more examples on ssh tunnels : https://cloudbase.200013.net/doc/linux/ssh/ssh_tunelling.html https://cloudbase.200013.net/doc/linux/ssh/ssh_tunelling.htm...
- tommica 4y agoThat is a useful guide - I used to do that with Spotify long time ago, when I was living in a different country
- rollulus 4y agoMy favorite Konami code level of cheat: ssh escape sequences. On a new line: ~. to terminate a connection that’s stuck. Or ~? for more help.
- thedougd 4y agoGreat one! This needs communicated more broadly. I spent too many years of my life killing terminals because of a dead ssh connection.
- danuker 4y agoBetter yet, use Mosh. https://mosh.org/ https://mosh.org/
- LeoPanthera 4y agoSince it's sometimes unclear whether you are on a new line in a stuck terminal, I find it simpler to remember the sequence as [Return][~][.]
- marcobehler 4y agoThanks, indeed a great one! Will put it in the article.
- thedougd 4y agoFavorites for scripting including the ability to run any command or script on the remote. ssh remotehost reboot Heredoc syntax also works: ssh remotehost <<'EOF' ls cat /etc/passwd reboot EOF
- LeoPanthera 4y ago> ssh-keygen -t rsa -b 4096 -C "your@email.com" Is there any evidence that 2048 bit RSA keys are insufficient? 4096 bit keys are absolutely huge. I don't know if working with them is also slower, but I would guess so.
- dandanua 4y agoThe most annoying "feature" of ssh for me is the discrepancy between public keys presentations. How I suppose to verify fingerprint of a new server if it uses a different presentation in the keys file?
- acatton 4y agoPSA: scp is deprecated.[1] Please use sftp.[2] [1] https://lwn.net/Articles/835962/ https://lwn.net/Articles/835962/ [2] https://man.openbsd.org/sftp.1 https://man.openbsd.org/sftp.1
- marcobehler 4y agoDidn't know that! Thank you, will update the post.
- dhsysusbsjsi 4y agoAs an scp user, this article was not a great advertisement for sftp. It listed a whole host of problems that don't apply to me, then finished with: "[sftp] disadvantage is a much less friendly user experience, especially in cases where one simply wants to type a command and see files move." I just want to copy a file. I'll keep using scp.
- hotpotamus 4y agoI had that thought too, but rsync should mostly replace it. I have run into situations where rsync isn't available so scp -r has been helpful though.
- thefilmore 4y agoThe scp command uses the SFTP protocol since OpenSSH 9.
- LanternLight83 4y agoIIRC, wasn't scp going to be rewritten in terms of SFTP behind the scenes?
- neurostimulant 4y agoscp uses sftp protocol by default since v8.8. You'll need to pass `-O` parameter to explicitly use the legacy scp protocol if you still need it for backward compatibility reason.
- Daviey 4y agoI like the idea for multiple Github accounts, but I have concerns over the suggestion: ``` Host github-work.com .. Host github-personal.com ``` Getting in the habit of using a fake FQDN (which right now aren't registered) feels pretty risky.
- cameronperot 4y agoThis is a nifty trick, but I recently had an issue where it would offer my other keys even with IdentitiesOnly yes specified in ~/.ssh/config. I found a solution [1], but it's not the most elegant. [1] https://superuser.com/a/859719 https://superuser.com/a/859719
- kaliszad 4y agoI like how this guide also takes Windows into account, it has some unique challenges. I have written some notes especially on SSHFS (also for Windows!) and tunnels with SSH (e.g. SOCKS proxy) as an OrgPage: https://www.orgpad.com/s/wRIx3rNLZ6y https://www.orgpad.com/s/wRIx3rNLZ6y These tricks saved my bacon so many times already. Most of it can be used with the FUDO PAM jump host appliance (https://fudosecurity.com/fudo-pam/ https://fudosecurity.com/fudo-pam/) that is based on FreeBSD and one of the developers spoke about it and other things on https://www.bsdnow.tv/ https://www.bsdnow.tv/ I think. Some of it works with OpenWRT's Dropbear nicely as well.