Operating System - HP-UX
1759964 Members
2923 Online
108889 Solutions
New Discussion юеВ

Trying to write an automated FTP script

 
Marco Shaw_1
Respected Contributor

Trying to write an automated FTP script

I'm not sure what I'm doing wrong...

#!/bin/sh

ftp -n IP <user username password
cd /some_dir
bin
prompt off
put /some_file
bye
EOF

All I seem to get is:
Could not determine cwdir: No such file or directory.

Perhaps a problem with the user itself. I first tried root the a regular user.

What might I be missing? I'm pretty sure the user's home dirs are setup properly.
5 REPLIES 5
Yang Qin_1
Honored Contributor

Re: Trying to write an automated FTP script

Hi, can you run the same steps from your commandline? I hope it is a typo -- "put /some_file" "/" here will give you trouble if your files are not located under / if the files are in /some_dir the it should be "mput some_name*" in case you want to use "prompt off" to transfer multiple files with mput/mget


Yang
James R. Ferguson
Acclaimed Contributor

Re: Trying to write an automated FTP script

Hi Marco:

You need to verify that your directories are as you think they are -- "No such file or directory" seems to say otherwise.

Regards!

...JRF...

Steven Schweda
Honored Contributor

Re: Trying to write an automated FTP script

A quick Google search for "Could not
determine cwdir" suggests that this message
is coming from the FTP server. As already
suggested, you should verify that the result
is the same when you do the work manually
instead of in the script.

> I first tried root the a regular user.

So, "root" and a normal user fail the same
way?

Google found several plausibly similar
inquiries with some plausible suggestions on
things to try or investigate.

> I'm pretty sure the user's home dirs are
> setup properly.

One of the suggestions I saw was:

Check the directory permissions on the parent directories. You need o+rx
on each directory from '/' to the cwd (user's home in this case).

It might help so see "ls -l" output showing
permissions and ownership on the users' home
directories (and every directory above them).
Knowing that you think that they're set up
properly is less valuable than seeing how
they're actually set up.
Yogeeraj_1
Honored Contributor

Re: Trying to write an automated FTP script

hi marco,

Please try to run the commands manually first to see if it is working properly before you script it!

Also look into secure copy (scp)

hope this helps!

kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Marco Shaw_1
Respected Contributor

Re: Trying to write an automated FTP script

It's taking me longer to fix this script than to do it manually... Not sure what is wrong, but I had already checked everything people mentioned in their replies.