FTP parameter

friends

How can I pass the FTP parameter to the machine the user and password

ip=192.168.80.15
user=FidenFtp
pass=Ftp01Fiden

ftp -n ip  user pass

that does not work for me

Many FTP clients allow you to create a ~/.netrc file like this:

machine 192.168.0.125
        login username
        password PaSsW@rD

machine hostname
        login username
        password oicu812

Note the 8 leading spaces are actually tabs.

The file must be chmod 600 or the ftp client will refuse to use it.

1 Like

Hi,

Most implementations of ftp will allow you to;

 ftp -n IP <<!EOF
                user "username" password
                "DO SOMETHING"
!EOF

Or you vcan generally put everything in a file and use a "-f" switch.

Regards

Gull04

1 Like

What Corona688 and gull04 said is absolutely correct but good practice is to not use ftp at all! Use any securified alternative ( sftp , scp , ...) instead. They can use keys so taht you do not have to store passwords anywhere (which is always a security hazard) and they won't transmit these keys (or passwords) unencrypted over the net, so that they could be sniffed by third parties. Both things are not the case with ftp .

I hope this helps.

bakunin

1 Like

Agreed.

Better to use SFTP and never use FTP.

1 Like