config ssh code example
Example 1: edit sshd_config
sudo nano /etc/ssh/sshd_config
sudo /etc/init.d/sshd restart
Example 2: ssh config
Host hostname1
SSH_OPTION value
SSH_OPTION value
Host targaryen
HostName 192.168.1.10
User daenerys
Port 7654
IdentityFile ~/.ssh/targaryen.key
Example 3: ssh conf
Host *
ForwardAgent no
ForwardX11 no
ForwardX11Trusted yes
User nixcraft
Port 22
Protocol 2
ServerAliveInterval 60
ServerAliveCountMax 30
Host server1
HostName server1.cyberciti.biz
User nixcraft
Port 4242
IdentityFile /nfs/shared/users/nixcraft/keys/server1/id_rsa
Host nas01
HostName 192.168.1.100
User root
IdentityFile ~/.ssh/nas01.key
Host aws.apache
HostName 1.2.3.4
User wwwdata
IdentityFile ~/.ssh/aws.apache.key
Host uk.gw.lan uk.lan
HostName 192.168.0.251
User nixcraft
ProxyCommand ssh [email protected] nc %h %p 2> /dev/null
Host proxyus
HostName vps1.cyberciti.biz
User breakfree
IdentityFile ~/.ssh/vps1.cyberciti.biz.key
LocalForward 3128 127.0.0.1:3128
Example 4: file connection ssh
sudo chmod 400 [key file]
sudo ssh -i [key file] [username]@[ip]