FTP - `Name or service not know`

12,342

The ftp command does not support the :5021 syntax for port numbers. Instead, there must be another way.

With some FTP clients, you can use a -P command line option:

ftp -P 5021 192.168.0.4

With others, you need to put the port number after the host address with a space:

ftp 192.168.0.4 5021

Use man ftp to see which yours supports.

Share:
12,342

Related videos on Youtube

rflood89
Author by

rflood89

I started getting into software development when I was 12 using the Game Maker program by prof Mark Overmars (not the footballer :P) and dabbled with its built in scripting language called GML which then booted me into software development for good. I then went on to learn C++ using Dev-Cpp which I like to think i'm half decent at. Currently I am in my 3rd of a computer science degree and using Emacs religiously (manly because its epic and can see myself molding the tool for my needs rather than bending backwards something which can't be modified) but hopefully I would like to be working in a programming environment with like minded people in the very short future.

Updated on June 04, 2022

Comments

  • rflood89
    rflood89 almost 2 years

    I have an app, on my iphone, which allows me to transfer songs too and from my linux desktop via ftp. The app indicates that the host address is 192.168.0.4 and the port to be used is 5021. I can connect fine to the device from filezilla but when I try to connect via the command line it fails with the error mentioned in the title.

    The command i'm using is ftp 192.168.0.4:5021 but it fails. I'm totally stumped. When I search for help on the internet the answer is to simply do what I've done already.

    Does anyone have an any idea on what to do?

  • rflood89
    rflood89 about 12 years
    Thanks for the prompt response. The -P parameter is not recognised, the -p parameter indicates an invalid argument and without the argument it simply refuses again. There doesn't appear to be any alternatives the syntax stated is ftp [..options..] [host [port]]
  • Greg Hewgill
    Greg Hewgill about 12 years
    Your Linux must have a different ftp program. Both the one on FreeBSD and the one on Mac OS X support -P. But yours says that you can put the port number after the host name, with a space, not a colon. Try ftp 192.168.0.4 5021.
  • rflood89
    rflood89 about 12 years
    Thanks alot it works! I was trying it with square brackets like an idiot, basically everything i could think off except on its own. Your a super star lol
  • Greg Hewgill
    Greg Hewgill about 12 years
    In man pages, the square brackets generally means it's an optional parameter, not that you would type the actual square brackets. So in your case, [host [port]] means you can specify no address, or just a host, or a host and a port.
  • rflood89
    rflood89 about 12 years
    cool, thanks for the tip :). I don't know why but all this command line stuff is like legal crack!
  • Mark Amery
    Mark Amery over 7 years
    He's already trying to connect directly to an IP; this is clearly not a DNS issue and modifying the hosts file won't help.
  • legendJSLC
    legendJSLC over 7 years
    I have meet the same problem. Neither ip or domain not work. untill I add domain and ip to the hosts file.