Create a script to add an .rhost entry remotely

Posted on 2005-04-22
Last Modified: 2010-04-21
I want to create a script that connects to a remote server and adds an entry to the .rhost file. How do you modify a file on a remote host?
Question by:heavenlydishes
    LVL 22

    Expert Comment

    Anything that uses .rhost is so insecure you probably shouldn't be using it.  Reconsider.  Look at the big picture and redesign your system so that it instead uses public keys and ssh or some other modern remote access tool.
    LVL 8

    Expert Comment

    you can do this in the script

    1>Connect to remote machine using atuomatic ftp
    2>take a back up of the .rhost file in the remote machine
    3>copy new .rhost file

    If you want to add a line you can use the command i specified in your eariler question to add a line
    LVL 51

    Accepted Solution

    beside the security issues about .rhosts ...

    ssh user@remotehost 'echo whatever >> /path/to/.rhosts'

    # same for rsh instead of ssh
    LVL 7

    Expert Comment

    rsh -l user remotehost echo whatever ">>" /path/to/.rhosts

    just my 0.02€...;)


    Author Comment

    Thanks for the comments all! ahoffman's worked for me.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
    The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    This video discusses moving either the default database or any database to a new volume.

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now