SOLVED: How do I connect ftp in one command

Hi a question about ftp syntax

I’m connecting to a vsftpd server

This works in a browser →

ftp://john:password@ip.of.server

But this is rejected from the cli →

ftp john:password@ip.of.server

Can you tell me what syntax works from the cli?

Thanks
swerdna

On Sat June 20 2009 12:06 am, swerdna wrote:

>
> Hi a question about ftp syntax
>
> I’m connecting to a vsftpd server
>
> This works in a browser →
> ftp://john:password@ip.of.server
>
> But this is rejected from the cli → ftp
> john:password@ip.of.server
>
> Can you tell me what syntax works from the cli?
>
> Thanks
> swerdna
>
>
man ftp

P. V.
“We’re all in this together, I’m pulling for you.” Red Green

Solved:

ftp ftp://username:password@servername

PV wrote:
> man ftp

what an unhelpful alt.usenet way to post!

swerdna, i used to know but haven’t used it in so long i’ve forgotten
(dang those GUI thing allow us to forget how to cli!)

ha! i’ve spent over an hour with man ftp and i’ve not figured it out
either, yet…

am looking forward to relearning…

and, will be watching closely to help PV with his/her next help request.


.~.
/V
/( )\ natural_pilot
^^-^^

You and I posted more or less simultaneously, so I imagine you have the answer by now.

But thanks for the sentiment natural_pilot. I had of course read the man pages and had the same trouble digging the answer out as you. I studied it for a long time before asking for help.

I find that a lot of man pages are written by ppl who do really know their subject but don’t really know how to communicate. Some posters to this forum are a bit that way too.

Anyway, I eventually divined it as:

ftp ftp://username:password@servername

> This works in a browser →
> ftp://john:password@ip.of.server
>
> But this is rejected from the cli →
> ftp john:password@ip.of.server

GOT IT!

build the file (using YOUR example data)
/home/[you]/.netrc


machine ip.of.server
login john
password password

then at the command line just:


ftp ip.of.server

and you are soon fully signed in and see a nice ftp> prompt

yipee!!

NOTES:

  1. ip.of server (like 195.135.221.134) can also be a name (like
    ftp.opensuse.org)

  2. if your .netrc includes the following as its last and only
    ‘default’ entry you can single cli login to any ftp server allowing
    anon use:


machine default
login [your email address]
password anonymous

enjoy…and, thanks again PV!


.~.
/V
/( )\ natural_pilot
^^-^^

hmmmm…seems in the fine Linux tradition there is more than one way
to skin this cat, also…

good on you swerdna…

i had tried that “ftp ftp://…” string with my web host and got
rejected…i scrolled back in bash history and now see that the
rejection was due to a simple typo…otherwise i think would have
found your solution, and saved an hour+ of my life…

oh, i forgot to mention that my ‘wisdon’ on .netrc came from google
and http://www.linux.com/archive/feature/119510
thank you linux.com!


.~.
/V
/( )\ natural_pilot
^^-^^

swerdna wrote:
> Solved: ftp ftp://username:password@servername

Hint:
Try ncftp as FTP client.
The ncftp package comes with programs as ncftpget, ncftpput and ncftpbatch,
making usage of FTP in scripts a lot easier.

Theo

Hey thanks guys. That’s a great start for me in the task of writing a cron job to call a script to open an ftp link to a backup machine and copy the contents of web servers across to the backup machine.

see! you didn’t mention in your initial posting that you were wanting
to ftp via a script…

and, now i wonder if you are missing the chance to use rsync??


.~.
/V
/( )\ natural_pilot
^^-^^

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The last thing worth mentioning is… why? If this is just to pull down
a file then thre are also better ways of doing this sometimes, such as:

wget ftp://server.goes.here/path/to/file/here/something.ext

Add --ftp-user=user --ftp-password=password if needed.

Good luck.

natural_pilot wrote:
> hmmmm…seems in the fine Linux tradition there is more than one way
> to skin this cat, also…
>
> good on you swerdna…
>
> i had tried that “ftp ftp://…” string with my web host and got
> rejected…i scrolled back in bash history and now see that the
> rejection was due to a simple typo…otherwise i think would have
> found your solution, and saved an hour+ of my life…
>
> oh, i forgot to mention that my ‘wisdon’ on .netrc came from google
> and http://www.linux.com/archive/feature/119510
> thank you linux.com!
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQIcBAEBAgAGBQJKPM64AAoJEF+XTK08PnB5+agP/0w7wNPzLHJUKMRWRKY8KDDV
tpIOnI56sLYiHpRo73kjW/0rA+HHINtpSPFiuIezm4/aY2kUQW7+fmuobLsGJ+qk
lmi8JD5EfgJKU7F5hr+Qe6lVZmDA5mn8AejsLSL4jPHWw/eXeIjap1ZYlkLfEOkx
aCqJVBksR2ebSVUOhmB6upSD0MWbPU9mbbp5Ga9W45MPoKNOiKeUH88tEC1WwVvg
dhd1wuZIy5RncvpnvK1k6lEiVjVuDWq0bEPcWkBqM6AagIlx+L5GYF1Kp/fHKZHY
93ukeT9N/kAVB46JJXPbuZiBnTVkbwtHeGsh2ljByxo/gAJgYEp3q1poj3Wf8OKc
yYBga2V3WpvNYuP4cGodhYguuCffwHphW53NwjZ5vwEd67a7QtckSYREQc6DPrrx
bOYgIsW1LobIXjNfAoyogAixPuvmM6ONyAzWjQdvWKKDQkxrCGWH+4MS29Cn0vPs
P5aLrGig6KaLQU5PoPCbPf/HejX3w1us0bYRRrJs/mHfG98OAFwCYNHKzmhXTm2m
1T1ympEurCdXfqnrD05ELKY8It+udMoikXNYu1gKrAwr4jR/MexZ41ouarO3LNcI
6eiP2UZo+i8klcLvsBIxGC6aajnMrQVG1l1ouvHWR9R8lg5HmyJILCwthHeVx/XN
nPoPT04rk7WDhGVb7tPM
=9bSr
-----END PGP SIGNATURE-----

Not at all. That’s firmly in the back of my mind :wink: This current problem is an associated issue.

Thanks ab, I’ll look into that – hadn’t even crossed my mind.

On Sat June 20 2009 02:06 am, swerdna wrote:

>
> natural_pilot;2002041 Wrote:
>> PV wrote:
>> > man ftp
>>
>> what an unhelpful alt.usenet way to post!
>>
>> swerdna, i used to know but haven’t used it in so long i’ve forgotten
>> (dang those GUI thing allow us to forget how to cli!)
>>
>> ha! i’ve spent over an hour with man ftp and i’ve not figured it out
>> either, yet…
>>
>> am looking forward to relearning…
>>
>> and, will be watching closely to help PV with his/her next help
>> request.
<snip>

> But thanks for the sentiment natural_pilot. I had of course read the
> man pages and had the same trouble digging the answer out as you. I
> studied it for a long time before asking for help.
>
> I find that a lot of man pages are written by ppl who do really know
> their subject but don’t really know how to communicate. Some posters to
> this forum are a bit that way too.
>
<snip>

In retrospect I can see that my overly terse reply was not helpful and I
should have explained more fully. At the time it had seemed to me that the
manual entry was clear that <username>:<password> required the ftp:// prefix.
I extend an apology to Swerdna and the entire Opensuse community.

P. V.
“We’re all in this together, I’m pulling for you.” Red Green

PV wrote:
> I extend an apology

accepted.

PS: for any lurking old pharts with lots of newsnet experience–read a
little in these fora as most (like 90%) folks here use it
(http://forums.opensuse.org) and you will see why the full top-post
convention of the old daze is not always useful, here… (and, a
threaded newsreader is the cat’s meow)

PS2: welcome to eye-candy lane…it is a whole nuther world.


.~.
/V
/( )\ natural_pilot
^^-^^

I extend an apology to Swerdna and the entire Opensuse community

Thanks – appreciated