Access files from prev box after SSH to another box


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Access files from prev box after SSH to another box
# 1  
Old 12-07-2007
Access files from prev box after SSH to another box

i'm not much of an advanced unix programmer but I'm trying to write a script to access files on box1 after ssh from box 1 to box2. when ssh is invoked in the script i'm getting logged into box2 and losing complete touch with box1 which is normal i guess.

but my main aim with my script is when i connect to box 2 i should be able to access files on box 1 to do my further operations.

my script is still at the basic level, for eg: which looks like this

ssh "$USER"@"$HOST" --> logged into box2 , the following lines are not executing.
ls -lrt ---> this line should execute on box2 but executing on box 1 only after exiting from box 2
echo $HOST
EOF
echo stop

are there any commands to make this possible i.e to view box 1 after ssh and do other functions etc. without exiting from box2


your comments will be very valuable


~Pharos
# 2  
Old 12-09-2007
Question

Unfortunatly ssh just doesn't work like this.

The best way to look at it is to think about what you are trying to achieve. If box2 needs information from box1, why not run the script on box to and have it ssh into box1 to get the info? If this is not possible, gather the information on box1, then ssh over and pass the info to box2.

If you explain what you need done, we can probably give you a hand in setting out the logic for it.
# 3  
Old 12-09-2007
Quote:
Originally Posted by pharos467
are there any commands to make this possible i.e to view box 1 after ssh and do other functions etc. without exiting from box2
Yes, it's called NFS but has nothing to do with SSH. You share a directory on one server and remotely mount it on the other.
# 4  
Old 12-11-2007
MySQL problem solved

Porter and Dragon, Thanks for your suggestions. I solved the problem now.

Due to confidential reasons i could not provide wht i exactly wanted, but here is an example which i did to solve my problem. Hope it will help others ...just in case


ssh "$USER"@"$HOST" -q -n "ls -lrt;echo $HOST;pwd"


I tried to give everything in a single line to change to my destination dir and later included my logic of scp to do copy from box 1 to box2.


Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. How to Post in the The UNIX and Linux Forums

Copying , renaming the file from windox box and ftp to Linux box

Hello my dear friends, Two file are auto generated from mon - fri at different directories on same windows box.Every day i have to copy the file, rename it (specific name)and ftp it to linux box specified directory. is it possible to automate this process,If yes this has to be done from windows... (1 Reply)
Discussion started by: umesh yadav
1 Replies

2. Shell Programming and Scripting

Notify when the script run(hourly)on my jump-box only when there is a failure on my remote-box

Team, Presently I have a script, which i have set up cron on one of my Jump-boxes,and gives me the output on every hourly basis,fetching the data from the remote machine.Basically it gives me the list of all active users logged and its count once we execute the script.Here the count is... (6 Replies)
Discussion started by: whizkidash
6 Replies

3. Red Hat

How to access redhat Linux box graphically from windows box?

Hi I have a linux box and need to access from windows graphically # uname -a Linux pc-l416116 2.6.18-155.el5 #1 SMP Fri Jun 19 17:06:47 EDT 2009 i686 i686 i386 GNU/Linux What components do I need to install on Linux and windows to do that? TIA (6 Replies)
Discussion started by: magnus29
6 Replies

4. Web Development

How to copy a selected value of list box into a text box in html form?

hi, i have a list box , a text box and a button in a html form. list box displays some values, when a user selects a value from the list box and press the button. the selected value should be copied to the text box value. can any1 give me a html and javascript code to do this facility. ... (1 Reply)
Discussion started by: Little
1 Replies

5. Red Hat

cannot ssh (use NFS) on RHEL box, but can mount external & ssh out of RHEL box

Ok, Im trying to get NFS working on my RHEL 5 box, apparently i can use the box as a client, but not as a server. If it helps i cant ssh into the box (server), but as a client ssh works fine. Ive configured server: /etc/hosts.allow: all : all all :all@all setup my /etc/exports file... (4 Replies)
Discussion started by: drs.grid
4 Replies

6. Shell Programming and Scripting

ftp file starting with particular name on Windows box to Unix box using shell script

Hello all ! I'm trying to write a shell script (bash) to ftp a file starting with particular name like "Latest_" that is present on a Windows box to UNIX server. Basically I want to set this script in the cron so that daily the new build that is posted on the Windows box can be downloaded to the... (2 Replies)
Discussion started by: vijayb4u83
2 Replies

7. Solaris

Need to copy printers from Sol8 box to Sol10 box-No luck so far

I need to copy the printers currently installed on a Sol8 box to a Sol10 box. I tried copying the printers.conf file from the Sol8 box and that worked until I went through the file and changed the server name to that of the Sol10 box. Another post on this forum suggested copying the entire... (1 Reply)
Discussion started by: todis
1 Replies

8. Shell Programming and Scripting

how to compare all files in one unix box has been to copied to another unix box

Hi our unix admin has copied all files from one unix box to new unix box. We just need to confirm that all the file systems are copied properly. How to validate. (9 Replies)
Discussion started by: sravanreddym
9 Replies

9. Shell Programming and Scripting

Moving files from Unix box to a windows box

Hi All, I need a little help .I want to transfer a file from unix box to a windows box,but the problem i'm facing is that in windows box FTP is not enabled and currently it is nearly impssible to change setting on windows box,i can not use the ftp method ,in my shell script to transfer the file.... (2 Replies)
Discussion started by: Preet
2 Replies

10. UNIX for Advanced & Expert Users

VPN client (windows Box),and Server (Unix Box)

If I want to access unix box via VPN tunnel,from windows box. What sould I configure on the windows client PC, and what should I enable on the Unix Server box ? I am using Solaris V10 intel platform, and I am using windows XP, and 2003 for client (0 Replies)
Discussion started by: zillah
0 Replies
Login or Register to Ask a Question