System Administration Guide, Volume 2

How to Search for and Remove .rhosts Files

  1. Become superuser.

  2. Search for and remove .rhosts files by using the find(1) command.


    # find home-directories -name .rhosts -print -exec rm{}
    

    home-directories

    Identifies the path to a directory where users' home directories are located. Note that you can enter multiple paths to search more than one home directory at a time. 

    -name .rhosts

    Identifies the filename. 

    -print

    Prints the current pathname. 

    -exec rm {} \;

    Tells the find command to apply the rm command to all files identified using the matching filename.

    The find command starts at the designated directory and searches for any file named .rhosts. If it finds any, it prints the path on the screen and removes it.

Example--Searching For and Removing .rhosts Files

The following example searches and removes .rhosts files in all the user's home directories located in the /export/home directory.


# find /export/home -name .rhosts -print | xargs -i -t rm{}