If I run:
ssh -i permissions_file.pem -t ubuntu@<AWS_Public_IP> 'bash run_tmux_experiment.sh'
Nothing runs on the aws machine. I tmux ls and no server is running. If I ssh into this machine and then run "bash run_tmux_experiment.sh" then it works.
For a little more info, here is approximately what run_tmux_experiment.sh looks like:
#!/bin/bash tmux \\ new-session "python long_expirement.py" detach-client
You should post more detailed information about from which system are you connecting (would differ from windows (yes it has ssh.exe) and unix based OS).
For sake of simplicity I presume you are connecting from Unix based OS:
To run a bash script you don't need to specify the shell. The user ubuntu
should have it as set default shell.
To specify default shell you can do: it in these ways:
sudo chsh -s /bin/bash ubuntu
:
enter your shell as :/bin/bash
root:x:0:0:root:/root:/bin/bash
Now to your actual issue:
You can run it multiple ways. I'll post only 2 in my eyes the best ones:
run local script on remote machine - no need to actually manually upload the script (note: no need to setup the default shell then):
ssh -i permissions_file.pem -t ubuntu@AWS_Public_IP 'bash -s' < /your/local/path/run_tmux_experiment.sh
if you still want to run the remote script you can do it the following way:
ssh -i permissions_file.pem -t ubuntu@AWS_Public_IP './remote/path/foo.sh'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.