ncftp not looking into .netrc

man ncftp states, that ncftp do not use .netrc file for storing preferences. See FILES section for details. Instead it use $HOME/.ncftp/ directory. Just connect to your server and use bookmark command for creating a record in $HOME/.ncftp/bookmarks file


This is rewrite of dchirikov's answer with links and a howto.

Although old man pages seem to indicate it was once the case, It appears that ncftp has not supported the .netrc file for quite some time. The most recent, official man page makes no mention of it. I found a debian bug report from 2002 regarding the lack of support. The ncftp developer (Mike Gleason) responded with:

The .netrc file has little to do with ncftpput's config file, which can contain exactly one set of login information. Proper parsing of a .netrc bloats the code without tangible benefit since you can't use it with ncftpput without editing it.

I think it's safe to say that .netrc support was intentionally removed and won't be returning anytime soon.

The ncftp way to achieve passwordless login/transfer is to make a bookmark. It's pretty straightforward:

$ ncftp -u username ftp.example.com
[...]
Password requested by [host IP address] for user "username".

User username okay, need password.

Password: 

Then you enter the password and you are in. You should get the server's welcome text and:

Restricted user logged in.
Logged in to ftp.example.com.

At the ncftp / > prompt, enter bookmark. You'll be prompted to give a name to the bookmark (the suggestion is a useful version of the host name, example in our example), and confirm that you want to save the password.

If you quit ncftp and browse the file ~/.ncftp/bookmarks, you'll see a line for your host, with the bookmark name, the host name, the username, and the password. The password is saved in an encoded form, which is probably not totally secure, but at least more secure than plaintext as it is in the .netrc file.

Now do:

$ ncftp example
[...]
Restricted user logged in.
Logged in to ftp.example.com.
ncftp / >

And there you are. The bookmarks are good for the put/get versions of ncftp too. For instance,

$ ncftpput example destdir file

Will put file on the server ftp.example.com in the directory destdir.

Tags:

.Netrc

Ncftp