📎 Webclip
SSH tricks
The page explains why SSH replaced telnet by encrypting and authenticating connections. It then shows how to configure it well, how to use key-based authentication, how to run remote commands, how to copy files, and how to set per-host client options in ~/.ssh/config.
It also covers server settings in sshd_config, local and remote port forwarding, SOCKS proxying for Firefox, mounting a remote filesystem with sshfs, and SSH clients for Windows and iOS.
Reading notes#
- SSH encrypts and authenticates connections, unlike telnet, which sent passwords in the clear.
- Per-user client configuration lives in
~/.ssh/config; system-wide client settings live in/etc/ssh/ssh_config; daemon settings live in/etc/ssh/sshd_config. - Key-based authentication uses public-key cryptography to prove ownership of the private key without revealing it.
ssh-keygencreates a private/public key pair, and the public key goes into the remote account’s~/.ssh/authorized_keys.- The private key should be protected like a password, and it should not be copied to the remote machine.
- A remote command can be run by placing it after the host name, as in
ssh host df. - File transfer can be done with
cat,scp, orsftp, and-Cenables compression for large files. ~/.ssh/configcan set options per host, includingUser,IdentityFile,BatchMode,EscapeChar,HostName, and wildcard host rules.sshd_configsettings highlighted on the page arePort,PermitRootLogin, andPasswordAuthentication.- Local port forwarding uses
ssh -L localport:B:remoteportand can route traffic through another server. - Remote port forwarding uses
ssh -R remoteport:A:targetportand can expose a local service through a remote machine. - SSH can provide a SOCKS proxy with
ssh -D localport host, and Firefox can use it as a SOCKS5 proxy. sshfsmounts a remote filesystem over SSH with FUSE.- The page mentions PuTTY for SSH from Windows and iSSH for SSH from iOS.
