Specifying port for ftp when using .netrc

Hi, does anybody know if it is possible to specify a particular port for an FTP address within a .netrc file ?

i have a script which opens the ftp to a machine and then instigates .netrc to login etc.. within .netrc i need it to go to a particular port to enable me to automate the dropping of files to the correct location. I cannot get it to work with the port..

The only way i can get it to work outside the .netrc is opening an ftp prompt and then typing open (host) (port) but this seems to not be possible in a script as when the ftp prompt is opened it just stops there and will not process any further commands.

Any ideas anybody ?

I don't believe the .netrc file supports adding a port, but it works if you specify it in the ftp command. As long as the machine name in the .netrc is specified it will connect and proceed with running the commands.

ftp <machine name in .netrc> <port>
1 Like

Hi in2nix4life, you got that spot on. the script is now fully working.

Many thanks for your help.

Regards