Getting rid of those pesky .rhosts files.

1.
#!/bin/sh
# Search for .rhosts files in user home directories
# You need to be root!

PATH=/usr/bin

for user in `cat /etc/passwd | awk -F: 'length($6) > 0 { print $6 }' | sort -u`
do
if [ -f $user/.rhosts ]; then
rm -f $user/.rhosts
echo "$user/.rhosts has been deleted" > /var/log/messages
fi
done

2.
nohup find /path/to/home -name ".rhosts" -exec rm {} \; &

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s