Passing credentials via .netric file in Linux

How to create netrc file...I searched in google & got to know that we have to create .netrc file in home directory, I've created .netrc file in in home directory
created .netrc file in home directory

more .netrc 
machine $HOSTNAME login xxxx password xxxxx

Note: echo $HOSTNAME
apachetomcat@dellsys.com

The two things to check with the use of .netrc are the syntax of the file content and the access rights of the file itself.

Here is an excerpt from some documentation I wrote several years ago but nothing has changed:

*****

The contents of the /.netrc file would, for example, be:-

machine plymsql login administrator password memorandum

NOTE: .netrc must have read/write access for the owner ONLY. If other users have read access it may fail to work and ftp will not auto-connect. Therefore, since in this case the user is root, should the file be re-created it must be set as follows:-
cd / <or cd to the home directory of the user under which the job is running>
chown <userid> .netrc
chmod 600 .netrc <giving read/write to only the owner (userid)>

If ftp finds the target nodename listed it uses the login name and password given to create an ftp connection to the target. Of course, this userid/password combination MUST give the process sufficient credentials and access rights to allow the reading/writing required to complete the required tasks. If the system manager changes the respective user account or password without reflecting this in /.netrc it will cause the whole ftp phase of the scripts to fail.

*****

Check these out and report back your progress, or lack of.

You can check out the .netrc functionality interactively by just entering "ftp <nodename>" at the command line. The ftp session should connect immediately without entering credentials. If it doesn't the .netrc mechanism isn't working. Ensure that the nodename can be resolved, eg. by an entry in /etc/hosts or other means such as DNS.

Thanks