Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env bash
- set -e #quit if command fails
- set -u #quit if variable error
- function connectioninfo() {
- echo -n @address:
- read osoite
- echo -n @user:
- read user
- echo -n @ssh password:
- read -s passu
- }
- function filetransfer() {
- echo File transfer started...
- sshpass -p $passu scp /home/atte/testi.txt $user@$osoite:/home/administrator/testi
- echo File transfer complete.
- }
- function remotecommands() {
- echo Executing commands...
- sshpass -p $passu ssh $user@$osoite "bash -s" << EOF
- cd /home/administrator/testi
- echo orderi
- ls
- rm testi.txt
- ls
- EOF
- echo Commands executed.
- }
- connectioninfo
- filetransfer
- remotecommands
- echo Script finished. @attejantunen
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement