My problem is a bit similar to one described here, but not the same. I cannot use sudo on external servers S1 / S2 / S3 (to install packages for example) unless they are binaries.
Each day I log onto the terminal locally, and run:
- type/run initialization command C1 locally
- connect to server S1 by ssh using alias1 (from .bashrc locally)
- connect to server S2 from S1 using alias2 (from .bashrc in S1)
- connect to server S3 from S2 using alias3 (...)
- type/run initialization command C2 in S3
- run "byobu" in S3, and then I do normal work in byobu.
I want to have a script, which does all those steps and leaves the terminal with byobu opened, cause I feel it is stupid, to type all those commands every day, but don't know how to change it :)
my try:
#!/bin/bash
ssh -C2qtnN -D1001 S1 & #C1 which is tunel for the browser
ssh S1
ssh S2 # here it fails, trying to execute "ssh S2" locally
ssh S3 # same as above
C2 # initialization command that has to be run before byobu on S3
byobu #this one wont work either - to open byobu ;S