1833803 Members
2346 Online
110063 Solutions
New Discussion

.netrc

 
SOLVED
Go to solution
Tiffany Yu
Occasional Contributor

.netrc

My .netrc file is as following:
machine A1 login user password pswd
But when the script executes ftp, it receive message as follows:
connect to A1
220 A1 Microsoft FTP Service (Version 5.0).
Error - .netrc file not correct mode.
Remove password or correct mode.
221
Is is because the server is not setup correctly or because the mode of the file is not correct? or something else?
Thanks!
4 REPLIES 4
Patrick Wallek
Honored Contributor
Solution

Re: .netrc

The permission on a .netrc file should be either 400 (-r--------) or 600 (-rw-------), that is read-only for the owner or read-write for the owner. Make sure the owner of the file is the user whose home directory the .netrc file is. Once these are taken care of, you will then stop receiving those messages.
James R. Ferguson
Acclaimed Contributor

Re: .netrc

Hi:

The man pages for 'netrc' ("man 4 netrc") note specifically:

"If the .netrc file contains password or account information for use other than for anonymous ftp, its owner must match the effective user ID of the current process. Its read, write, and execute mode bits for group and other must all be zero, and it must be readable by its owner. Otherwise, the file is ignored."

Regards!

...JRF...
linuxfan
Honored Contributor

Re: .netrc

Hi Tiffany,

The permissions on the .netrc have to be -r------- (400) or -rw-------(600)
change it using

chmod 600 $HOME/.netrc

Also make sure you have given the right ownership.

-Ramesh
They think they know but don't. At least I know I don't know - Socrates
Tiffany Yu
Occasional Contributor

Re: .netrc

I changed the permission to 600. Now it works. Thank you all very much for your rapid and accurate responses.
Tiffany