There is often a problem: to connect to a specific server via SSH, after connecting, always perform the same sequence of three commands there, and then there may be some different actions.
I want to automate the first part of the process.
I managed to write a bash script that, when launched, opens a separate terminal window, performs an SSH connection and leaves the terminal window open:
#! /bin/bash xfce4-terminal -e 'ssh username@host' Here's how I still have to execute three more predetermined commands in this ssh connection session? I have little understanding of the syntax of bash scripts. I tried to just add these commands like this:
#! /bin/bash xfce4-terminal -e ' ssh username@host комманда_1 комманда_2 комманда_3 ' And at least the line with ssh is executed. I understand this by the fact that in the terminal window a passphrase for the ssh key is requested, and if entered incorrectly, it asks two more times - exactly as in a normal ssh connection.
But when you enter the correct passphrase, the terminal window simply closes immediately.
ssh username@host 'ls -l; ps -aux; whoami'ssh username@host 'ls -l; ps -aux; whoami'ssh username@host 'ls -l; ps -aux; whoami'put a sign; between teams and take in quotes - Senior Pomidor