Ssh
Frequently used ssh snippets
How to's
Port forwarding
Say we want to connect to a web server running at example.com:8080 and we have user to connect to the server. We can create a tunel to see the server on our local port 9000 by doing:
ssh -L 9000:localhost:8080 user@example.comlocalhost:8080, is to forward connections from your local port 9000 to localhost:8080 on your server. Now we can simply connect to our webserver.
.pem managing
chmod 400 *.pemAdd user
execute
sudo adduser userthen, edit
/etc/ssh/sshd_configand add/edit:AllowUsers user PasswordAuthentication yesthen, execute
sudo service ssh reloadAdd to sudoers
usermod -aG sudo userReview ssh login attemps
sudo vim /var/log/auth.logCopy the file "foobar.txt" from the local host to a remote host
scp foobar.txt your_username@remotehost.edu:/some/remote/directory
References
Was this helpful?