0

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

10
  • Most of these works for me, though all you really need is gnome-terminal --tab -t "NASIR-QEMU" -e 'ssh 10.10.10.1' (Provided you have bash or at least some shell set as the login shell on 10.10.10.1. Does everything work if you just run ssh 10.10.10.1 from your current terminal ? Commented Mar 21, 2017 at 21:56
  • @nos thank for reply.. simple ssh 10.10.10.1 works fine, but my requirement is login ssh and type bash on the remote ssh terminal. so the command gnome-terminal --tab -t "NASIR-QEMU" -e 'ssh 10.10.10.1' login to 10.10.10.1. but i want after that to execute automatically "bash" command there... Commented Mar 21, 2017 at 22:03
  • 2
    You would need -e 'ssh -t 10.10.10.1 /bin/bash' then, or whichever full path you have to bash on 10.10.101 (Note there's no semicolons, but you need the -t in this case). But the setup of your 10.10.10.1 machine is rather odd if yo need to explicitly run bash, so I suspect there's something else that could trip you up. Commented Mar 21, 2017 at 22:08
  • @nos your command "gnome-terminal --tab -t "NASIR-QEMU" -e 'ssh 10.10.10.1 /bin/bash'" open a terminal blank and hangs there, Thanks Commented Mar 21, 2017 at 22:10
  • 1
    Yes, I edited it, you need the -t argument Commented Mar 21, 2017 at 22:11

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.