#2095
[How-To] SSH
SSH to a machine using an SSH bastion (proxy)
ssh -o ProxyCommand="ssh -W %h:%p -q BASTION_USER@BASTION_SERVER" FINAL_USER@FINAL_SERVER
for example :
ssh -o ProxyCommand="ssh -W %h:%p -q root@10.2.3.88" fusion@svc-1
and with additional SSH options :
ssh -o ProxyCommand="ssh -W %h:%p -q -p 8022 -oHostKeyAlgorithms=+ssh-dss root@10.2.3.88" -oHostKeyAlgorithms=+ssh-dss fusion@svc-1
—-
SSHPass
sshpass -p password ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null user@target
Execure command as ssh (using SSH PASS)
sshpass -p password ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null user@target whoami sshpass -p password ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null user@target cat /etc/hosts sshpass -p password ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null user@target 'sed -i ...'
[How-To] CentOS & RHEL Installer Windows 10 sur un Raspberry Pi – Korben
Gen SSH keys
To enable color over ssh (with or without sshpass) :
or (in case of error like “Pseudo-terminal will not be allocated because stdin is not a terminal”)
SSH without password (using Public/Private key)
If the connection is refused, ensure the permissions on .ssh folder is also correct on remote host
SSHD Update config only for a dedicated host :
Disable HostKey check (CLI) :
Disable UserKnownHostsFile
SSH with Identity file and Bastion :
~/.ssh/config :
Permissions :
pemfile : 0600
config file : 0600
.ssh folder : 0700
Convert PEM key to PPK key:
Convert PPK key to PEM key: