Advertisement
Guest User

Untitled

a guest
Nov 2nd, 2016
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.16 KB | None | 0 0
  1. $ cat create_frl.sh
  2. #!/usr/bin/bash
  3.  
  4. set -e # Exit on error
  5.  
  6. if [ $# -ne 1 ]
  7. then
  8.     echo "Usage: $0 <host>"
  9.     exit 1
  10. fi
  11.  
  12. host="$1"
  13. password="dupad15"
  14. user="tacbf"
  15.  
  16. function run_remote_root()
  17. {
  18.     #StrictHostKeyChecking set to "no" to prevent asking in the first connection
  19.     ssh -o "StrictHostKeyChecking no" "root@${host}" "$@"
  20. }
  21.  
  22. function run_remote()
  23. {
  24.     ssh "${user}@${host}" "$@"
  25. }
  26.  
  27. # run_remote_root apt-get update
  28. run_remote_root apt-get -y install rtorrent python-libtorrent #python-pip
  29. # run_remote_root python pip install ipython
  30. run_remote_root useradd -m "${user}" -s /bin/bash
  31. echo -e "${password}\n${password}\n" | run_remote_root passwd "${user}"
  32.  
  33. # Copy authorized_keys
  34. run_remote_root mkdir --mode=700 /home/"${user}"/.ssh
  35. run_remote_root cp /root/.ssh/authorized_keys /home/"${user}"/.ssh/authorized_keys
  36. run_remote_root chown -R "${user}:${user}" /home/"${user}"/.ssh
  37.  
  38. scp check_torrents.py "${user}@${host}":
  39. scp .rtorrent.rc "${user}@${host}":
  40.  
  41. ####################################
  42.  
  43. run_remote mkdir torrents .rtorrent
  44.  
  45. run_remote python check_torrents.py torrents
  46. run_remote screen -d -m rtorrent
  47. run_remote
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement