salsaman | 1 Oct 2010 01:26
Picon
Picon
Favicon

Controlling ftp from a program/commandline

Hi,
I am trying to do something like this:

$ mkfifo fifo
$ ftp ftp.example.com < fifo

$ echo username > fifo
$ echo passwd > fifo

but actually from within a C program. The problem is it doesn't work, ftp
seems to need the username and password from an actual terminal.

I can't do e.g:

ftp < script.file
because the commands for ftp are generated at runtime.

Any suggestions how to get it to do what I want, i.e write to the stdin of
ftp ?

Cheers,
Salsaman.

--

-- 
Gllug mailing list  -  Gllug <at> gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug

Tethys | 1 Oct 2010 01:31
Picon

Re: Controlling ftp from a program/commandline

--------

salsaman <at> xs4all.nl writes:

>Any suggestions how to get it to do what I want, i.e write to the stdin of
>ftp ?

popen(3)?

Tet
--

-- 
Gllug mailing list  -  Gllug <at> gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug

Alistair Mann | 1 Oct 2010 01:56

Re: Controlling ftp from a program/commandline

salsaman <at> xs4all.nl wrote:
>  Hi, I am trying to do something like this:
>
>  $ mkfifo fifo $ ftp ftp.example.com < fifo
>
>  $ echo username > fifo $ echo passwd > fifo
>
>
>  but actually from within a C program. The problem is it doesn't work,
>  ftp seems to need the username and password from an actual terminal.
>
>
>  I can't do e.g:
>
>  ftp < script.file because the commands for ftp are generated at
>  runtime.
>
>  Any suggestions how to get it to do what I want, i.e write to the
>  stdin of ftp ?

Would ftp be happy using the username and password via ~/.netrc instead?

Cheers,
-- 
Alistair Mann

--

-- 
Gllug mailing list  -  Gllug <at> gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug

(Continue reading)

salsaman | 1 Oct 2010 03:05
Picon
Picon
Favicon

Re: Controlling ftp from a program/commandline

On Fri, October 1, 2010 01:56, Alistair Mann wrote:
> salsaman <at> xs4all.nl wrote:
>>  Hi, I am trying to do something like this:
>>
>>  $ mkfifo fifo $ ftp ftp.example.com < fifo
>>
>>  $ echo username > fifo $ echo passwd > fifo
>>
>>
>>  but actually from within a C program. The problem is it doesn't work,
>>  ftp seems to need the username and password from an actual terminal.
>>
>>
>>  I can't do e.g:
>>
>>  ftp < script.file because the commands for ftp are generated at
>>  runtime.
>>
>>  Any suggestions how to get it to do what I want, i.e write to the
>>  stdin of ftp ?
>
> Would ftp be happy using the username and password via ~/.netrc instead?
>
> Cheers,
> --
> Alistair Mann
>
> --
> Gllug mailing list  -  Gllug <at> gllug.org.uk
> http://lists.gllug.org.uk/mailman/listinfo/gllug
(Continue reading)

Nix | 1 Oct 2010 08:49
Picon

Re: Controlling ftp from a program/commandline

On 1 Oct 2010, Tethys verbalised:

> --------
>
> salsaman <at> xs4all.nl writes:
>
>>Any suggestions how to get it to do what I want, i.e write to the stdin of
>>ftp ?
>
> popen(3)?

Or, if it insists its controlling terminal is a TTY, you could do as
script(1) does and use a PTY. This starts to get kind of irritating
fast, though.
--

-- 
Gllug mailing list  -  Gllug <at> gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug

john maclean | 1 Oct 2010 11:00
Picon
Gravatar

host and dig commands

What's the diff between `host` and `dig`? When is it best to use either tool?

host av.com
av.com has address 68.180.206.184
av.com has address 206.190.60.37
av.com mail is handled by 50 av2-mrin.yahoo.com.
av.com mail is handled by 50 ccmrin2.corp.re1.yahoo.com.
av.com mail is handled by 50 av1-mrin.yahoo.com.

dig av.com

; <<>> DiG 9.7.0-P1 <<>> av.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 30979
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;av.com.                                IN      A

;; ANSWER SECTION:
av.com.                 7070    IN      A       206.190.60.37
av.com.                 7070    IN      A       68.180.206.184

;; Query time: 0 msec
;; SERVER: 10.108.11.151#53(10.108.11.151)
;; WHEN: Fri Oct  1 10:00:10 2010
;; MSG SIZE  rcvd: 56

--

-- 
(Continue reading)

Bruce Richardson | 1 Oct 2010 11:22

Re: host and dig commands

On Fri, Oct 01, 2010 at 10:00:53AM +0100, john maclean wrote:
> What's the diff between `host` and `dig`? When is it best to use either tool?

They do the same things.  As you've seen, the output format is
different.  Also, the default behaviour differs; "host av.com" does the
same as "dig av.com any", not "dig av.com".

Which you use is your preference.  If you need to use the output in
scripts, then it's down to which format is most useful for the task.

-- 
Bruce

The ice-caps are melting, tra-la-la-la.  All the world is drowning,
tra-la-la-la-la.  -- Tiny Tim.
--

-- 
Gllug mailing list  -  Gllug <at> gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug
salsaman | 1 Oct 2010 13:08
Picon
Picon
Favicon

Re: Port filtering question

On Wed, September 29, 2010 05:32, Walter Stanish wrote:
>> I have been struggling with this for a few days now. I am trying to set
>> up
>> an icecast server on my desktop machine. Everything seems to be working
>> fine, except that nobody can connect to the port.
>>
>> ....
>>
>> I am not running any kind of firewall or packet filtering firewall
>> software on the PC as far as I can tell, as I generally use the router
>> as
>> the firewall. So is this a bug in the router, an ISP issue or is there
>> something on the desktop machine doing this ?
>
> One way to find out which part of your network infrastructure filters a
> port
> is to run a traceroute with that port selected.  Whilst traceroute is a
> cool
> hack, and old versions tended not to use TCP, modern implementations
> such as that in recent versions of nmap will allow you to specify UDP or
> TCP ports, along with a host of other options.
>
> For a simple example, you could use:
>  nmap --traceroute -PT -p80 your.target.host.com
>
> I seem to remember that icecast doesn't normally run on port 80 by
> default, a quick google suggests '8000'.
>
> - Walter
> --
(Continue reading)

Mick Farmer | 1 Oct 2010 12:51
X-Face
Picon
Favicon

Suitable Laptop for Ubuntu

Dear GLLUGers,

The subject says it all.  Any recommendations gratefully
received.

Regards,

Mick               /"\                      
                   \ /                      
Linux Registered    X  ASCII Ribbon Campaign
User #287765       / \ Against HTML Mail
--

-- 
Gllug mailing list  -  Gllug <at> gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug

david@gbenet.com | 1 Oct 2010 13:36

Re: Suitable Laptop for Ubuntu

Hello Mike

Acer and Dell or even IBM come to mind

David

Mick Farmer wrote:
> Dear GLLUGers,
>
> The subject says it all.  Any recommendations gratefully
> received.
>
> Regards,
>
> Mick               /"\                      
>                    \ /                      
> Linux Registered    X  ASCII Ribbon Campaign
> User #287765       / \ Against HTML Mail
>   
--

-- 
Gllug mailing list  -  Gllug <at> gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug


Gmane