Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ftp script passing username and password

Status
Not open for further replies.

jpn1

Technical User
Jul 9, 2007
34
0
0
US
I have an AIX box and a windows PC and need to have a script execute on the unix box that logs into a windows FTP server and does a put.

I can't seem to pass the username and password over and direction is greatful.
 
Hi jpn1,

You need to configure rsh (or ssh) on the windows PC and then allow login to this pc on the aix box!

You can download windows rsh freeware from this link:


For procedure on installing the rsh, have a look into this:


After installing this exe, rsh will be started as a windows service in the background.

Then you need to allow rsh access from your windows PC on the aix box by writing down the windows PC's host name in the aix box user's home directory in a file called .rhosts.

Once you do this, try running rsh from the windows pc on the command line prompt to get the options that you can run rsh with. This is what should you get:

Code:
Runs commands on remote hosts running the RSH service.

RSH host [-l username] [-n] command

  host            Specifies the remote host on which to run command.
  -l username     Specifies the user name to use on the remote host. If
                  omitted, the logged on user name is used.
  -n              Redirects the input of RSH to NULL.
  command         Specifies the command to run.

I hope this is useful. Please let me know if you need any clarifications.

Regards,
Khalid
 
I'm assuming the windows machine is running an FTP server, and furthermore assuming that it's IIS.

Your .netrc file will need to include the domain as part of the userid.

machine 1.2.3.4 login DOMAIN\\userid password nofunkycharactersplease
 
The .netrc file worked great after auto login I defined an init macro and entered all my commands, added an extra line and saved.

Then in my script I just ftp hostname and everything moves.
Now I can have cron or another script run the first one.

Thanks for the direction.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top