System Administration Guide: Resource Management and Network Services

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 file name. 

    -print

    Prints the current path name. 

    -exec rm {} \;

    Tells the find command to apply the rm command to all files that are identified by using the matching file name.

    The find command starts at the designated directory and searches for any file that is named .rhosts. If it finds such as file, find 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 that are located in the /export/home directory.


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