Linux - Merge Two Separate Ssh Sessions

Hi all,

Would love some advice about how to get a solution here.

Goal - join two separate ssh sessions together. I want to see if keys used to login to a bastion host can be different than keys used to login to server from bastion.

Scenario - I will login to a bastion host using ssh and my keys from my machine. The bastion host will then login to the actual server on my behalf - using a different set of keys. The ssh session from my machine to the bastion host and from the bastion host to the server now needs to be connected, for me to feel as if a transparent SSH proxy is just forwarding commands.

I have read up a bit on ssh proxies but it seems like this is not implemented right off the bat. I have read - http://en.wikibooks.org/wiki/OpenSSH...and_Jump_Hosts , I have also looked at screen sessions - but am not sure how to "merge" two ssh screen sessions together.

Any advice will be very helpful.

Thank you.


Similar Content



SSH Error

I am trying to login to my linux server. I was initially doing "ssh hostname". The login did not work, so I tried "ssh username@IP", which still prompted me with the yes/no prompt, but I received this error:

Code:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
XX:XX...:XX.
Please contact your system administrator.
Add correct host key in /Users/user/.ssh/known_hosts to get rid of this message.
Offending RSA key in /Users/user/.ssh/known_hosts:5
RSA host key for 192.168.1.3 has changed and you have requested strict checking.
Host key verification failed.

CentOS 6 - Connection Reset By Peer Error

Hi,

I have a CentOS 6 machine [Machine X], which I connect to using a putty client or from another CentOS 6 machine.

Now, the machine X intermittently sends a connection reset message to all SSH sessions -

Code:
Read from remote host 1.1.1.1: Connection reset by peer
Connection to 1.1.1.1 closed.

I have switched off the firewall on the machine & there are no session timeout values set.

How do I find out what is causing this issue?


Thanks

Bhushan

CentOS 7 Login Fail

CentOS Linux 7 (core)
Kernel 3.10.0-299.el17.x86_64 on an x86_64
local host login:kd
[kd@localhost ~]$

The above is what displays on a black screen.
The program was d/l to DVD and then installed on a usb stick and booted from there. No password.

This is the second installation. On the first, a pw was specified but at login, it would not accept input from the keyboard except the enter key which resulted in Incorrect Password.

Help would be much appreciated.

How To Return From Shell 'read' Command Passed In Expect Script?

I have a shell script that calls an expect script I wrote to ssh login to another host and get user input regarding that host's network configuration. I pass four arguments to the expect script: the remote host ip address, the username, the password, and the list of commands to run. My expect script is below:

#!/usr/bin/expect
# Usage: expectssh <host> <ssh user> <ssh password> <script>

set timeout 60
set prompt "(%|#|\\$) $"
set commands [lindex $argv 3];

spawn ssh [lindex $argv 1]@[lindex $argv 0]

expect {
"*assword:" {
send -- "[lindex $argv 2]\r"
expect -re "$prompt"
send -- "$commands\r"
}

"you sure you want to continue connecting" {
send -- "yes\r"
expect "*assword:"
send -- "[lindex $argv 2]\r"
expect -re "$prompt"
send -- "$commands\r"
}

timeout {
exit }

expect -re $prompt
send -- "exit\r"
}

The script runs well, except that if I send a command such as 'read' that requires user input, the script does not continue or exit after the user presses enter. It just hangs.

The commands I pass to the expect script and it's call are as follows:
SCRIPT='hostname > response.txt;netstat -rn;read net_card?"What is the network interface card number? " >> response.txt; read net_mask?"What is the subnet mask? " >> response.txt'

/usr/bin/expect ./expectssh.exp $hostip $usr $pswd "$SCRIPT"

Any suggestions on how I can pass a command to my expect script that requires user input without it hanging?

On a side note because I know it will come up - I am not allowed to do key-based automatic SSH login. I have to prompt for a username and password, which is done from my main shell script.

Thanks for any suggestions and help you can provide!

Create Windows VirtualBox Guest On Centos

I have VirtualBox up and running on my headless Centos 6 machine, am using http://sourceforge.net/projects/phpvirtualbox/ as a GUI, and created a virtual machine and installed Windows 7 on it.

I can access it using the VirtualBox console (via phpvirtualbox interface), however, only can see part of the screen and the mouse doesn't work properly. I can also access it using Windows Remote Desktop Connection using IP 192.168.1.200:9000 (why port 9000?), but again the mouse doesn't work.

I have the following ext packs installed on the server.
Code:
login as: Michael
Michael@192.168.1.201's password:
Last login: Sat May 23 10:06:04 2015 from 192.168.1.10
[Michael@devserver ~]$ VBoxManage list extpacks
Extension Packs: 1
Pack no. 0:   Oracle VM VirtualBox Extension Pack
Version:      4.3.10
Revision:     93012
Edition:
Description:  USB 2.0 Host Controller, Host Webcam, VirtualBox RDP, PXE ROM with                                                                                                                                                              E1000 support.
VRDE Module:  VBoxVRDP
Usable:       true
Why unusable:
[Michael@devserver ~]$

Do I need additional extensions to better interact with the guest? How are they installed? Thank you

Ftp: Connect: No Route To Host

I have two VM's on a Redhat 7 Base machine and installed Redhat 6 on both machnies. Trying to use FTP. I can ping both each other.
VSFTPD is installed,
firewall is enabled.
vsftpd.conf is also updated for anonymous user login.
I could login using anonymous user.
while uploading file
I am getting a message as ftp: connect: no route to host

VNC - CentOS 7 Server Login Screen Refresh Preventing Authentication

TigerVNC 1.4.1 CentOS 7 Server on Intel 64 bit vncViewer is running on Windows 7 & 8.1 Using both TigerVNC and Tight VNC viewers The CentOS GUI login screen appears with the correct (su) user name. The screen refreshes ~ twice per second allowing only one character to be entered in the Authentication box before refreshing. I am unable to login remotely via VNC. PuTTY access, etc., works fine.

How To Copy File From Remote Host To Local Host Then Delete From Remote Host

I have an expect script to SSH to a remote host and obtain some user inputs and information about the server/network configuration. The responses are saved in a text file that I then need to copy to my local host so that I can read the lines into variables for use in the parent shell script.

Is there a way to do this without needing to enter the username and password for the local host to use function scp? I have tried the following in my expect script to no avail:
Code:
spawn scp $usr@$host:$flnm .
expect {
	-re "(.*)assword:" { 
		send -s "$pswd\r"
	}
}

I have also tried to directly scp the file and enter the username and password to try to debug the issue, and that doesn't work either:
Code:
spawn scp file.txt user@host:file.txt
expect {
	-re "(.*)assword:" {
		send -s "password\r"
	}
	"you sure you want to continue connecting" {
		send -s "yes\r"
		exp_continue
	}
}

In both scenarios I have used exp_internal 1, and there are no errors. But I do not end up with the file on my local host.

Following the copy, I would like to delete the file from the remote host. Any suggestions on how to accomplish this?

Xorg Issues With Other X Sessions And Overclocking In Arch

Hey, I'm having a bit trouble getting this working right.

I'm using mate desktop and lightdm
my .xinitrc only contains exec "mate-session"

Xorg file
http://pastebin.com/ipBMwT38

I can login to another X session fine, and start mate desktop with startx. This defeats the purpose of running a seperate X for games though...

steam launches fine from terminal, but my keyboard or mouse doesn't work.

Also in Xorg I enabled coolbits = 24 still can't use NVclock to adjust anything even though it detects my video card details fine.

Access A Host From A Different Subnet In Linux

Hi all,

I have a host#1 with ip=192.168.3.100 and a host#2 with ip=192.168.2.100. Both hosts are connected to some linux device with 2 interfaces : eth0 with ip=192.168.2.1 and eth1 with ip=192.168.3.1.

So host#1 is connected to eth1 and host#2 to eth0. I would like to ping host#2 from host#1 and vice versa. How can I do that ?

I tried :
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
iptables -A FORWARD -i eth0 -o eth1 -j ACCEPT
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

but it didn't work

PS
This is my first post here, so please don't be very strict to me
Looking forward to hearing from anybody as I'm out of ideas...

BR,
Dmitry