Help! How to find the local host after few ssh hops to remote host???

Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Help! How to find the local host after few ssh hops to remote host???
# 1  
Old 03-27-2010
Help! How to find the local host after few ssh hops to remote host???

I do a ssh to remote host(A1) from local host(L1). I then ssh to another remote(A2) from A1.

When I do a who -m from A2, I see the "connected from" as "A1".

=> who -m
userid pts/2 2010-03-27 08:47 (A1)

I want to identify who is the local host who initiated the connection to remote host A2.

Is there a tool that would help me find it in a easy way
# 2  
Old 03-27-2010
I'd look for the $SSH_CONNECTION variable in your environment.
# echo $SSH_CONNECTION 1840 22
# 3  
Old 03-27-2010
SSH_CONNECTION gives me the last remote host from where I hopped.

I would like to find which local host initiated it. In my example, sitting on A2 host, i want to find that L1 originated the connection, eventhough i hopped to A1 first.

Now SSH_CONNECTION from A2 shows A1 and not L1.
# 4  
Old 03-28-2010
Dont think you would be able to get that information. Your first SSH terminates on A1, and you create a completely new one from there to A2 - why would you think A2 would know about L1?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Copy local files to single remote host but multiple folders using rsync

I'm trying to copy a file myfile.scr from my local Linux server to multiple folders on remote AiX server using single rsync command. Below command helps me copy the file "myfile.scr" from my localhost to a remote host folder "/app/deployment/tmpfiles" rsync --delay-updates -F --compress... (1 Reply)
Discussion started by: mohtashims
1 Replies

2. IP Networking

SSH to remote host using SOCK5 proxy

I am trying to connect to a remote host C from my node host A. HostA <====> HostB <====> HostC A tunnel has already been formed using SOCKS5 between HostA and HostC. Now I want to SSH from A to C. The SOCKS5 IP us and port 1082. The command I am using is : ssh -L... (1 Reply)
Discussion started by: Junaid Subhani
1 Replies

3. Shell Programming and Scripting

Pause processes in remote host and resume execution in another remote host

Hi, Given addresses of 2 remote machines, using a shell script is it possible to get the state of running processes in "src" stop all the processes in "src" exit out of "src" ssh into "dest" resume the state of executing processes captured in step 1 in "dest" Assumption: "src" is... (3 Replies)
Discussion started by: Saeya Darsan
3 Replies

4. Shell Programming and Scripting

Copy a file from local host to a list of remote hosts --- perl script

Hi friends, i need to prepare a script ( in perl) i have a file called "demo.exe" in my local unix host. i have a list of remote hosts in a file "hosts.txt" now i need to push "demo.exe" file to all the hosts in "hosts.txt" file. for this i need to prepare a script(in perl, but shell... (5 Replies)
Discussion started by: siva kumar
5 Replies

5. Shell Programming and Scripting

ssh to multiple hosts and saving the output in the local host

hi I have a script to login from a host "A" to a list of hosts in a file and perform some commands inside it...its somethin like this for i in `cat file` do ssh -t $i " command1 ; command2; ..." done I wanna save the outputs in a file in the current host "A" i.e from where I am... (3 Replies)
Discussion started by: ningy
3 Replies

6. Shell Programming and Scripting

running commands to remote host from centralized host

Gurus/Experts We have a centralized UNIX/Solaris server from where we can actually ssh to all other UNIX/Solaris servers...I need to write a script that reside on this centerlized server and do FileSystem monitoring (basically run df -h or -k) of other remote servers and then send an email to me... (6 Replies)
Discussion started by: anjum.suri
6 Replies

7. Solaris

unable to ssh to remote host

server is ok, I can login on console. however, when I use SSH teachia, there is no repsond. i have check ps-ef | grep ssh, it shows ok. restart ssh too. still not working. Anything else I need to check? # ps -ef | grep ssh root 24706 1 0 Jun 12 ? 0:00... (7 Replies)
Discussion started by: uuontario
7 Replies

8. Shell Programming and Scripting

ssh to remote host and execute command

Hi, could anyone please tell me how to ssh to remote host foo and execute command on it and print the result on local host? Thanks, Paresh (1 Reply)
Discussion started by: masaniparesh
1 Replies

9. Shell Programming and Scripting

ssh to a remote host

i want a script with expect or perl or shell which will do ssh to remote will take commandline argument and run the script in remote host....... i.e that will be like ./ssh.exp remoteip username passwd / can someone help me on this? (1 Reply)
Discussion started by: Aditya.Gurgaon
1 Replies

10. Solaris

How to delete the files from local host to remote host

Hi all, i am copying .gz files from production server to development server using "scp" requirement is after copying .gz files i want to delete old .gz files(two days back) in development server from production server. like this way i need to delelte .log ,.z and .dmp files... (3 Replies)
Discussion started by: krishna176
3 Replies
Login or Register to Ask a Question

Featured Tech Videos