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
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.

script for ssh-ing and logging out

  • 29-02-2012 10: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


Welcome!

It looks like you're new here. Sign in or register to get started.

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.


Welcome!

It looks like you're new here. Sign in or register to get started.
Advertisement