简体   繁体   English

在Linux终端中,如何使用gnome-terminal打开ssh会话并在ssh会话中键入bash命令

[英]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. 问题:我尝试使用“以下命令”但没有使用,它仅连接到ssh,但仅连接到计算机,但不执行命令“ bash”。

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" 注意: “仅为张贴示例输入了一个伪IP(10.10.10.1),因此请不要误导”

Help is highly appreciated!!! 非常感谢帮助!!!

Thanks 谢谢

use ssh 10.10.10.1 /bin/bash as you need to specify the absolute path. 使用ssh 10.10.10.1 /bin/bash因为您需要指定绝对路径。 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.. ie bash. 尝试做echo来测试这是否可行,因为当ssh登录也登录到终端时,您至少将能够看到一些输出-与您正在执行的命令相同。即bash。 so you may not be able to distinguish 因此您可能无法区分

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM