Can't get automatic ftp working within system() method.

Discussion in 'C Programming' started by Peter Ivarsson, Sep 12, 2006.

  1. Hi,

    I have a program that's creates a .netrc in $HOME.
    When I at the AIX prompt write "ftp xxx.yyy.com", the ftp command
    transfers a file to the remote host as I want.
    When I in my code write "status = system( "ftp xxx.yyy.com" ).
    I get the error below:
    Connected to xxx.yyy.com.
    220 buick FTP server (Version 4.1 Thu Sep 12 23:46:23 CDT 2002) ready.
    Name (xxx.yyy.com:ZZZ): 331 Password required for ZZZ.
    530 Login incorrect.
    It seams that the ftp command doesn't find the .netrc in $HOME.
    And that automatic login doesn't work.
    But the $HOME is correct when I do 'system( "echo Dollar home = $HOME"
    );'

    This code is running in AIX 5.3.

    Does anyone have a clue?

    Best Regards
    / Peter Ivarsson
    Peter Ivarsson, Sep 12, 2006
    #1
    1. Advertising

  2. Peter Ivarsson

    kondal Guest

    Peter Ivarsson wrote:
    > Hi,
    >
    > I have a program that's creates a .netrc in $HOME.
    > When I at the AIX prompt write "ftp xxx.yyy.com", the ftp command
    > transfers a file to the remote host as I want.
    > When I in my code write "status = system( "ftp xxx.yyy.com" ).
    > I get the error below:
    > Connected to xxx.yyy.com.
    > 220 buick FTP server (Version 4.1 Thu Sep 12 23:46:23 CDT 2002) ready.
    > Name (xxx.yyy.com:ZZZ): 331 Password required for ZZZ.
    > 530 Login incorrect.
    > It seams that the ftp command doesn't find the .netrc in $HOME.
    > And that automatic login doesn't work.
    > But the $HOME is correct when I do 'system( "echo Dollar home = $HOME"
    > );'
    >
    > This code is running in AIX 5.3.
    >
    > Does anyone have a clue?
    >
    > Best Regards
    > / Peter Ivarsson


    ..netrc is getting opened and is parsed by the ftp program. I think that
    the password is wrong. Why don't you add -d option for the ftp command
    to enable the debug messages. This enables you to see what message
    transfer are going through between the server and the client.

    ps. -d option for ftp gives debug messages in linux, hope it is same
    for AIX

    -kondal
    kondal, Sep 12, 2006
    #2
    1. Advertising

  3. HI,

    You were right the user name was wrong.
    But the user name was the LOCAL user name on my computer.
    I still have the feeling that ftp is not reading the .netrc file
    althouh it should.
    Just as I only wrote ftp ftp.www.com and had no .netrc file.

    Best regards
    / Peter Ivarsson

    kondal wrote:
    > Peter Ivarsson wrote:
    > > Hi,
    > >
    > > I have a program that's creates a .netrc in $HOME.
    > > When I at the AIX prompt write "ftp xxx.yyy.com", the ftp command
    > > transfers a file to the remote host as I want.
    > > When I in my code write "status = system( "ftp xxx.yyy.com" ).
    > > I get the error below:
    > > Connected to xxx.yyy.com.
    > > 220 buick FTP server (Version 4.1 Thu Sep 12 23:46:23 CDT 2002) ready.
    > > Name (xxx.yyy.com:ZZZ): 331 Password required for ZZZ.
    > > 530 Login incorrect.
    > > It seams that the ftp command doesn't find the .netrc in $HOME.
    > > And that automatic login doesn't work.
    > > But the $HOME is correct when I do 'system( "echo Dollar home = $HOME"
    > > );'
    > >
    > > This code is running in AIX 5.3.
    > >
    > > Does anyone have a clue?
    > >
    > > Best Regards
    > > / Peter Ivarsson

    >
    > .netrc is getting opened and is parsed by the ftp program. I think that
    > the password is wrong. Why don't you add -d option for the ftp command
    > to enable the debug messages. This enables you to see what message
    > transfer are going through between the server and the client.
    >
    > ps. -d option for ftp gives debug messages in linux, hope it is same
    > for AIX
    >
    > -kondal
    Peter Ivarsson, Sep 13, 2006
    #3
  4. Hi,

    Mr Kondal was right that the user name was wrong.
    But the user name was the LOCAL user name on my computer.
    I still have the feeling that ftp is not reading the .netrc file
    althouh it should.
    Just as I only wrote 'ftp ftp.www.com' and had no .netrc file.

    Best regards
    / Peter Ivarsson

    kondal wrote:
    > Peter Ivarsson wrote:
    > > Hi,
    > >
    > > I have a program that's creates a .netrc in $HOME.
    > > When I at the AIX prompt write "ftp xxx.yyy.com", the ftp command
    > > transfers a file to the remote host as I want.
    > > When I in my code write "status = system( "ftp xxx.yyy.com" ).
    > > I get the error below:
    > > Connected to xxx.yyy.com.
    > > 220 buick FTP server (Version 4.1 Thu Sep 12 23:46:23 CDT 2002) ready.
    > > Name (xxx.yyy.com:ZZZ): 331 Password required for ZZZ.
    > > 530 Login incorrect.
    > > It seams that the ftp command doesn't find the .netrc in $HOME.
    > > And that automatic login doesn't work.
    > > But the $HOME is correct when I do 'system( "echo Dollar home = $HOME"
    > > );'
    > >
    > > This code is running in AIX 5.3.
    > >
    > > Does anyone have a clue?
    > >
    > > Best Regards
    > > / Peter Ivarsson

    >
    > .netrc is getting opened and is parsed by the ftp program. I think that
    > the password is wrong. Why don't you add -d option for the ftp command
    > to enable the debug messages. This enables you to see what message
    > transfer are going through between the server and the client.
    >
    > ps. -d option for ftp gives debug messages in linux, hope it is same
    > for AIX
    >
    > -kondal
    Peter Ivarsson, Sep 13, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Guest
    Replies:
    1
    Views:
    739
    Guest
    Jun 29, 2004
  2. kj7ny
    Replies:
    9
    Views:
    255
    Peter Otten
    Aug 9, 2007
  3. Ezra Zygmuntowicz
    Replies:
    2
    Views:
    104
    Ezra Zygmuntowicz
    Jul 10, 2006
  4. D. Buck
    Replies:
    2
    Views:
    447
    D. Buck
    Jun 29, 2004
  5. fmbright
    Replies:
    8
    Views:
    196
Loading...

Share This Page