- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- script to find .netrc file
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-04-2009 03:10 AM
тАО10-04-2009 03:10 AM
please provide me with a script to find
.netrc file in a system)
please use the below command in the script
find / -name .netrc
this script is only for checking
the script will give an output as
-if there is no .netrc file present in system it will echo "OK"
-if there is one or more than .netrc file(s) then it will echo "NOK" & the number of files present.
regards
chicuks
Solved! Go to Solution.
- Tags:
- find
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-04-2009 03:28 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-04-2009 03:50 AM
тАО10-04-2009 03:50 AM
Re: script to find .netrc file
find / -name .netrc > netrc_files 2> /dev/null
num=$(wc -l < netrc_files)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-04-2009 04:16 AM
тАО10-04-2009 04:16 AM
Re: script to find .netrc file
found_netrc=0
cat /etc/passwd |cut -d: -f 6 |
while read homedir
do
if [ -f $homedir/.netrc ]
then
found_netrc=1
break
fi
done
[ $found_netrc = 0 ] && echo OK || echo NOK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-04-2009 02:28 PM
тАО10-04-2009 02:28 PM
Re: script to find .netrc file
ll /home/*/.netrc
If nothing shows then there are no .netrc files in $HOME directories. Now I said 'normal' system, so if you have users with non-standard $HOME directories, you'll have to search using the passwd file. This will look in the exact user $HOME directory:
cut -f6 -d: /etc/passwd | while read HOMEDIR
do
NETRC=$HOMEDIR/.netrc
[ -f $NETRC ] && ll $NETRC || echo "\t$NETRC not present"
done
If .netrc is found, there will be an ll of the file. Otherwise, there is a message that is indented saying that the file is not present.
Bill Hassell, sysadmin