1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2010
    Rep Power

    Shell script that logs into another machine and executes some commands

    Hello, I am trying to write a script that connects to a server and executes some commands on there. Something like this:


    telnet remote_machine
    cd /home/some_directory
    cat a_file_in_current_directory

    Unfortunately after login/password I guess the script doesn't jump past the telnet command, until I exit. What do I need to do to make the script start executing commands in the remote shell?
  2. #2
  3. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Rep Power
    Use ssh instead of telnet and you can do most anything you need on the remote machine.

    Comments on this post

    • SimonJM agrees : ssh is the way to go as Doug says
    Doug G
    I've never been able to appreciate the sublime arrogance of folks who feel they were put on earth just to save other folks from themselves .." - Donald Hamilton

IMN logo majestic logo threadwatch logo seochat tools logo