Ragav
Ragav

Reputation: 325

In linux terminal how to open a ssh session and type bash command inside the ssh session using gnome-terminal

Problem: I tried Using the Below commands but no use, it only ssh to the machine but not execute the command "bash" after connected to ssh target.

Trails:

Method #1 : gnome-terminal --tab -t "NASIR-QEMU" -e "/bin/bash -c 'ssh -t 10.10.10.1;bash;bash'"
Method #2 :  gnome-terminal --tab -t "NASIR-QEMU" -e "/bin/bash -c 'ssh -t 10.10.10.1;bash'"
Method #3 : gnome-terminal --tab -t "NASIR-QEMU" -e "/bin/bash -c 'ssh 10.10.10.1 ;bash'"
Method #4 : gnome-terminal --tab -t "NASIR-QEMU" -e 'ssh -t 10.10.10.1;bash'
Method #5 : gnome-terminal --tab -t "NASIR-QEMU" -e 'ssh -t 10.10.10.1"bash;bash"'

this method#4 #5 closes my open terminal

Note: "a fake IP (10.10.10.1) is entered for posting example only so pls dont get misleaded"

Help is highly appreciated!!!

Thanks

Upvotes: 0

Views: 1377

Answers (1)

v_sukt
v_sukt

Reputation: 1442

use ssh 10.10.10.1 /bin/bash as you need to specify the absolute path. try doing echo to test if this works since you will at least be able to see some output as the ssh login also logs into a terminal- the very same command that you are executing.. i.e. bash. so you may not be able to distinguish

Upvotes: 1

Related Questions