Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ cat create_frl.sh
- #!/usr/bin/bash
- set -e # Exit on error
- if [ $# -ne 1 ]
- then
- echo "Usage: $0 <host>"
- exit 1
- fi
- host="$1"
- password="dupad15"
- user="tacbf"
- function run_remote_root()
- {
- #StrictHostKeyChecking set to "no" to prevent asking in the first connection
- ssh -o "StrictHostKeyChecking no" "root@${host}" "$@"
- }
- function run_remote()
- {
- ssh "${user}@${host}" "$@"
- }
- # run_remote_root apt-get update
- run_remote_root apt-get -y install rtorrent python-libtorrent #python-pip
- # run_remote_root python pip install ipython
- run_remote_root useradd -m "${user}" -s /bin/bash
- echo -e "${password}\n${password}\n" | run_remote_root passwd "${user}"
- # Copy authorized_keys
- run_remote_root mkdir --mode=700 /home/"${user}"/.ssh
- run_remote_root cp /root/.ssh/authorized_keys /home/"${user}"/.ssh/authorized_keys
- run_remote_root chown -R "${user}:${user}" /home/"${user}"/.ssh
- scp check_torrents.py "${user}@${host}":
- scp .rtorrent.rc "${user}@${host}":
- ####################################
- run_remote mkdir torrents .rtorrent
- run_remote python check_torrents.py torrents
- run_remote screen -d -m rtorrent
- run_remote
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement