.netrc refuses password (original) (raw)
September 19, 2003, 10:54am 1
Hi trying to ftp a printer to collect info but the ftp file shows that when it gets to password the mode is incorrect
both the login and the password are not compulsory (e.g. if the user hits the enter button twice the ftp session is initiated)
any ideas
w33man September 19, 2003, 11:21am 2
sorry forgot to mention the .netrc file contains only the machine and login this allows me to get as far as the password in the ftp session (which only consists of me hitting the enter button)
when the line password is entered in the .netrc file, the error message appears
Perderabo September 19, 2003, 11:46am 3
The printer is probably ignoring the user and password. Try using "bogus" as the user and password.
w33man September 22, 2003, 6:11am 4
tried your suggestion Perdo but no joy
these are some of the options I have tried (and the results)
.netrc file
machine machinename
login bogus
".netrc" 2 lines, 30 characters
$ ftp machinename
Connected to machinename.
220 AXIS 540/542 FTP Printer Server V5.31 Feb 21 1997 ready.
331 User name ok, need password
Password: (at this point the enter key is hit)
230 User logged in
I need the password part above to be automatic
.netrc file
machine machinename
login bogus (anything entered here allows access)
password bogus (anything entered here allows access) but not automatically
".netrc" 3 lines, 48 characters
$ ftp machinename.
Connected to machinename..
220 AXIS 540/542 FTP Printer Server V5.31 Feb 21 1997 ready.
Error - .netrc file not correct mode.
Remove password or correct mode.
221 Goodbye.
ftp>
Perderabo September 22, 2003, 7:51am 5
Did you read the text of the error message that you posted? Maybe you should try changing the mode of the .netrc file....
If you type "man netrc", you will probably see some language like "Its permissions should be set to disallow read access by group and others (see chmod(1))." You have not done that. That is why you are having problems.
davidg September 22, 2003, 8:49am 6
chmod 400 /path/to/.netrc
does the trick. You don't want to let anyone beside the owner read the .netrc file. It contains a users password, right.
Regs David
w33man September 23, 2003, 4:45am 7
Thanks lads as I said at the start Perdo just trying to get my head round this Unix stuff, but you two have helped a great deal. Any books forums or other paraphenalia you could recommend would be greatly appreciated, especially with regard to programming in Unix.