Online Expert Day - HPE Data Storage - Live Now
April 24/25 - Online Expert Day - HPE Data Storage - Live Now
Read more
cancel
Showing results for 
Search instead for 
Did you mean: 

viewing remote file

himacs
Super Advisor

viewing remote file

Hi admins,

I have established ssh passwordless authentication between 2 servers.I can login/scp between servers w/o p/w.Now i want to view serverA:/tmp/test from server B.

gcc@task:/home/gcc>cat gcc@x.x.x.x:/home/gcc/file
cat: Cannot open gcc@x.x.x.x:/home/gcc/file: No such file or directory

what command i should fire to view.

Regards
himacs
4 REPLIES
Jeff_Traigle
Honored Contributor

Re: viewing remote file

ssh x.x.x.x 'cat /home/gcc/file'
--
Jeff Traigle
himacs
Super Advisor

Re: viewing remote file

Hi Jeff,

Thanks for the response.Your command doing only direct ssh login to other server.I want to view the file w/o logging in to server A.

Regards
himacs
Patrick Wallek
Honored Contributor

Re: viewing remote file

>>I want to view the file w/o logging in to server A.

How do you expect to do that? How can you look at a file without somehow logging into the server?

The command that was given above will connect to the remote server, cat the file, and then disconnect.

That is the most expedient way to do what you require.

You cannot do this directly with 'cat' or 'more' or 'less' because those have absolutely no idea what the 'user@server:file' syntax means. Those utilities will just assume it is a local file and error as you have seen.

Dennis Handly
Acclaimed Contributor

Re: viewing remote file

>I want to view the file w/o logging in to server A.

Then you should be using NFS.