problems faced while using ssh

View: New views
3 Messages — Rating Filter:   Alert me  

problems faced while using ssh

by kknegi :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message

Hi all,

we are using OpenSSh 3.7.1p1 version in both unix and Windows environment.
Also we had sucessfully implemented Password Less Authentication to connect to unix machine from windows using SSH.

we are able to run a script made in unix end but the same script is not getting executed when we try to run it through windows command prompt.

To make the picture more clear i will show u the errors which we are getting while executing the script from Windows command prompt:-

C:\>ssh shadm@hpcc558.corp.hp.com /home/shadm/shcalc/DateProject/test.sh > test1.log

grep: can't open rates.rel
expr: Syntax error
grep: can't open canada_exchange_rate.txt
grep: can't open month_midmonth_release.txt
sed: Cannot find or open file month_midmonth_release.txt.

Even we changed the permissions for the above files for which we are getting the error, but still we are not able to open those files from Windows End.

Is there something to do with SSH permissions????

can anyone please help us in this regard.

Regards,
Kishore

Re: problems faced while using ssh

by jalburger :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message


> C:\>ssh shadm@hpcc558.corp.hp.com /home/shadm/shcalc/DateProject/test.sh > test1.log

> grep: can't open rates.rel
> expr: Syntax error
> grep: can't open canada_exchange_rate.txt
> grep: can't open month_midmonth_release.txt
> sed: Cannot find or open file month_midmonth_release.txt.

Does your shell script contain the full file path for the files that are giving an error? (rates.rel, canada_exchange_rate.txt, month_midmonth_release.txt)

Re: problems faced while using ssh

by Greg Wooledge :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View Threaded | Show Only this Message

On Tue, Dec 12, 2006 at 10:10:43PM -0800, kknegi wrote:
> C:\>ssh shadm@... /home/shadm/shcalc/DateProject/test.sh >
> test1.log

What does this script look like?

> grep: can't open rates.rel

You realize that the script will be executed with its working directory
set to shadm's $HOME, correct?

> expr: Syntax error

Most likely, you forgot to quote something properly.  In general, I
abhor the use of expr(1) in shell scripts.  Its only real purpose is
in writing legacy (pre-POSIX, pre-ksh) Bourne shell scripts.  There
are shell builtins that can do almost everything expr does, but faster
and cleaner.

> grep: can't open canada_exchange_rate.txt
> grep: can't open month_midmonth_release.txt
> sed: Cannot find or open file month_midmonth_release.txt.

I think the fact that you're sitting in $HOME instead of wherever you
expected to be is the most likely candidate for all three of these.

> Is there something to do with SSH permissions????

Sounds more like you need a few pointers in writing shell scripts.