How to remove an ssh host by name or ip from your authorized hosts file.
bash |copy code |?
1 ssh-keygen -R {server.example.com}2 ssh-keygen -R {ssh.server.ip.address}
How to remove an ssh host by name or ip from your authorized hosts file.
bash |copy code |?
1 ssh-keygen -R {server.example.com}2 ssh-keygen -R {ssh.server.ip.address}
You want to know instantly who has logged in your ssh server. You can be emailed automatically including in .bashrc file of the user you want to monitor following co必利勁
mmands:
bash |copy code |?
1 echo 'ALERT - Root Shell Access (hostname) on:' `date` `who` | mail -s "Alert: Root Access from `who | cut -d"(" -f2 | cut -d")" -f1`" [email protected]
Prefered method if ssh is available.
bash |copy code |?
1 Another way, if you have SSH:2 3 4 5 rsync -aE -e ssh directory user@hostB:target_dir6 7 8 9 or from hostB
With this command you can tunnel your communications if you set software to connect to localhost 127.0.0.1 port 9999
Sometimes when you connect to a ssh server whois host key has changed, ssh client warns you about it. If you want to ignore that advice use StictHostkeyChecking no option.
rsync -aE -e ssh user@hostA:directory target_dir
If you want to connect to a ssh server in verbose mode, just and some -v options.
You can also use the z (--compress) switch to rsync if network throughput is an issue.
Sometimes you need to login to a remote server without typing your password. Really usefull when you want to copy files to remote servers in your bash script routines. To allow the server to do this you have to copy your public key. Here is how to do it:
bash |copy code |?
1 ssh -D 9999 [email protected]