0

I'm trying to connect to my Filezilla server (ms windows host) from command line under Debian 8.

I searched for documentation and saw plenty of tutorials saying that a good way to connect to a server in one line with credentials is:

ftp -in ftp://myusername:mypasswd@ip.v4.addr.here

When I run this command, ftp do not connect and I get the following error:

ftp: ftp://myusername:mypasswd@ip.v4.addr.here: Name or service not known

Does anybody know what's wrong here ? Do I have to specify any port or something ? (the server is listening on port 21)

My goal is to write a short bash script that would upload a specific file. I only miss the connection part :\

Thank you !

  • Are you able to FTP to the host interactively, by using ftp ${IPADDRESS}? – DopeGhoti Dec 2 '15 at 23:40
  • @DopeGhoti Yes sir, and it works like a charm ! – Stphane Dec 2 '15 at 23:44
  • 2
    I checked out ftp's man page, and it doesn't appear to support what you're trying to do. lftp, however, can, and if you are downloading a file, curl and wget can. – DopeGhoti Dec 3 '15 at 0:05
  • 1
    No, but it's in most repositories; apt-get install lftp or yum install lftp depending on if you're using a Red Hat or Debian-derived distro; if it's Arch, some invocation of pacman would do the trick. – DopeGhoti Dec 3 '15 at 0:13
  • 1
    The ancient and primitive ftp client is what you have to use on archaic systems where you don't have any other choice. On modern systems, or on any system where you can either install it as a package or have the privs and resources to compile and install the source code, use lftp as @DopeGhoti suggested. – cas Dec 3 '15 at 1:40
1

I used to write ftp script all of the time! Very old school. As misled by others here, FTP is designed to work as a batch script and just because it's archaic doesn't mean it doesn't work. Ftp and vsftp is highly insecure because your id/password is sent clear text over the network. This is why people us sftp or scp (which uses the SSH protocol). But, if clear text passwords over a network is not a concern for your environment, e.g. it's a closed network, ftp is a valid option and a bit easier to set up and maintain than services using ssh.

This is an example script below:

#!/bin/bash ftp -nv myservernameorip << EOF quote USER myuserid quote PASS mypasswd binary ls put some_files get some_files quit EOF

Just replace 'myservernameorip', 'myuserid' and 'mypasswd' with the real host name / IP, and account information; as well as change the ls, put and/or get command 'some_files' with real file paths.

  • Thank you ! The backup server is located on the private network .. I figured out that I can configure my online backup ftp service in a way that I wont have to specify my credentials when I try to connect from my server. The authentication process only grant access to my ip ! :) Furthermore only ftp is allowed (so no ssh based ftp clients !) – Stphane Dec 7 '15 at 21:55
  • An upvote would be appreciated ;-) – Andrew Dec 7 '15 at 23:51
  • 1
    +1 for both your time and testimony :p – Stphane Dec 8 '15 at 9:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.