Ask for a shell script to log in to the server

when working, you need to ssh to a transit server first, and then sudo su admin, and finally ssh to one of the dev test servers (there are multiple).
it"s troublesome to repeat this every day. I need to put a script on the transit machine or on my local machine. According to the passed parameter ssh to the target test server.
but the following script only executes the first sentence and does not execute the second sentence.

transfer script
go_dev.sh

-sharp!/bin/bash
sudo su fueladminprd
-sharp go dev4
ssh 192.168.1.104

if you want effect
go_dev.sh dev1 switch users and ssh to 192.168.1.101
go_dev.sh dev2 switch users and ssh to 192.168.1.102

Nov.03,2021

your two steps can be combined into one step, and your goal will be achieved

go_dev.sh can be as follows

-sharp!/bin/bash
ssh -t user1@server1 sudo -u fueladminprd  ssh $1

server1 is the transit server you mentioned

Menu