Skip to content

Ssh connection¤

  1. ssh username@server
  2. ssh username@groupname@jumpserver server

Ssh without password¤


Download sshpass link

cd folder
make install

with password¤

sshpass -p your-pwd ssh username@server

sshpass -p your-pwd scp -r username@server:/tmp/* ~/Desktop/

with password file¤

echo your-pwd > /tmp/pwd.txt

sshpass -f /tmp/pwd.txt ssh username@server

sshpass -f /tmp/pwd.txt scp -r username@server:/tmp/* ~/Desktop/

with a user¤

ssh -l user username@server

multi line command execution¤

read -r -d '' command << EOM
echo "${localVar}"
cd /remote/path
git pull
process=\$(ls -la | awk '{print \$1}')
echo "\${process}"

ssh username@server "${command}"
ssh username@server << 'ENDSSH'
cd /remote/path
git pull
process=$(ls -la | awk '{print $1}')
echo "${process}"
Back to top