code.fastix.org

Dateiansicht:

Datei:Projekte -> Linux:new ssh-hostkeys -> generate_new_ssh_hostkeys.sh
md5:bd674defb0e89db15a040caa4dfaa4dd
sha1:9268cf09eba8b06ed491d5ccc0a38c6eb01a293e
Download-Link:Download
  1. #!/bin/bash
  2.  
  3. oldDir=$(pwd);
  4. DateTime=$(date +"%F_%H%M%S");
  5. cd /etc/ssh/;
  6. if [ ! -d backup ]; then
  7.         mkdir "backup_${DateTime}";
  8. fi
  9. mv -f ssh_host_*_key     "backup_${DateTime}/";
  10. mv -f ssh_host_*_key.pub "backup_${DateTime}/";
  11. ssh-keygen -t rsa1    -f ./ssh_host_key         -N "";
  12. ssh-keygen -t dsa     -f ./ssh_host_dsa_key     -N "";
  13. ssh-keygen -t rsa     -f ./ssh_host_rsa_key     -N "";
  14. ssh-keygen -t ed25519 -f ./ssh_host_ed25519_key -N "";
  15. cd "${oldDir}";
  16.