Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

script for ssh-ing and logging out

  • 29-02-2012 09:19PM
    #1
    Registered Users, Registered Users 2 Posts: 3,457 ✭✭✭


    Hi,

    I'm trying to write a script that automatically ssh-es into a network, executes a command, and logs out

    ssh <login-node>
    <command>
    exit

    I know the trouble is with "scope". Are there ssh options that will let me get around this? So that I can perform the command on the login-node via a script executed off the login node?

    Thanks


Comments

  • Registered Users, Registered Users 2 Posts: 1,193 ✭✭✭liamo


    If you want to log in via a script then you must set up ssh keys to remove the need for a password.

    The remote execution of the command is very simple :
    ssh myuser@myremotelocation "some command"

    That will log in to the remote location, execute the command and log out.


  • Registered Users, Registered Users 2 Posts: 3,457 ✭✭✭Morbert


    Thanks!


  • Closed Accounts Posts: 18,966 ✭✭✭✭syklops


    Also check out expect. Can be useful also.


Advertisement