| Introduction to Remote Administration |
|
The Golden Rule of Remote Administration
never change a network settings on a remote machine without a scheduled reboot to previous configurationstandard client-server model
|
| Secure Shell (SSH): Connecting to Remote Linux Systems |
to connect need to know
Step-by-Step Connection
to close connection enter 'exit' |
| SSH Key Authentication and Using SSH Keys |
|
SSH keys are crytographic proof of identity SSH key has two parts
Generate a Private Key
|
| Copying Files Securely: scp and rsync |
|
The Simple Copy: scp
scp stands for Secure Copyworks exactly like cp but over SSH upload (Local to Remote): scp filename.txt [email protected]:/home/anna/copies filename.txt to the server's home directory download (Remote to Local): scp [email protected]:/var/log/syslog ./copies the server's syslog to your current directory The Smart Copy: rsync
scp is dumbit copies the whole file every time rsync is smart it checks what has changed and copies only the differences also supports resuming interrupted transfers. Syntax: rsync -avz <source> <destination>flags
|
| SSH Configuration: ~/.ssh/config |
|
repeatedly entering SSH credentials can be tedious use shortcuts on local machine create or edit ~/.ssh/configthe file Host myserver
HostName 192.168.1.50
User anna
IdentityFile ~/.ssh/id_ed25519
Host work
HostName server.company.com
User admin
Port 2222
can simply use
ssh myserver ssh work |
| Port Forwarding and Tunneling with SSH |
|
can access services blocked by firewalls
scenario
db server running on 192.168.1.50for security purposes only accepts connections from local host need to connect from a different computer on the network solution
can set up a secure tunnel between ports on different computersssh -L 3306:localhost:3306 [email protected]point db client to localhost:3306 SSH forwards traffic from localhost:3306 to 192.168.1.50:3306 connects to remote db as if it were local |
| Remote File Systems: sshfs |
sshfs allows mounting a remote folder as if it were a local USB device
|
| Best Practices for Secure Remote Access |
|
Disable Password Authentication
once SSH keys are working turn off password authenticationedit /etc/ssh/sshd_config PasswordAuthentication no ChallengeResponseAuthentication norestart SSH sudo systemctl restart ssh Disable Root Login
never allow root to log in directlyedit /etc/ssh/sshd_config PermitRootLogin no Change Default Port (optional)
bots blindly attack port 22configure SSH to run on port 2222 security thru obscurity install fail2ban Use Fail2Ban
service watches the logsif someone fails to log in 5 times in a row, it bans theirIP address using the firewall |
| Summary |
covers
key points
|