Dateiansicht:
Datei: | Projekte -> Linux:new ssh-hostkeys -> generate_new_ssh_hostkeys.sh |
---|---|
md5: | bd674defb0e89db15a040caa4dfaa4dd |
sha1: | 9268cf09eba8b06ed491d5ccc0a38c6eb01a293e |
Download-Link: | Download |
- #!/bin/bash
- oldDir=$(pwd);
- DateTime=$(date +"%F_%H%M%S");
- cd /etc/ssh/;
- if [ ! -d backup ]; then
- mkdir "backup_${DateTime}";
- fi
- mv -f ssh_host_*_key "backup_${DateTime}/";
- mv -f ssh_host_*_key.pub "backup_${DateTime}/";
- ssh-keygen -t rsa1 -f ./ssh_host_key -N "";
- ssh-keygen -t dsa -f ./ssh_host_dsa_key -N "";
- ssh-keygen -t rsa -f ./ssh_host_rsa_key -N "";
- ssh-keygen -t ed25519 -f ./ssh_host_ed25519_key -N "";
- cd "${oldDir}";