How to Execute Linux Commands on Remote System over SSH

5 Responses

  1. NILESHKUMAR CHHALLANI says:

    Awesome share

  2. yazul says:

    3rd example is wrong :
    $ ssh [email protected] uname; hostname; date

    commands “hostname” and “date” excute locally and not thru ssh tunnel !!!
    (local sh split command line on “;” and execute each of them.

    you can test :
    $ ssh [email protected] uname; uname
    $ ssh [email protected] hostame; hostame

    a correct example would be :
    $ ssh [email protected] “uname; hostname; date”

  3. ericm says:

    Hi Pradeep,

    the quote below seems to imply system-info.sh is a local script, which is executed on a remote system (192.168.10.10) However, I have found that this only work if the script is on the remote system. In other words, ssh can execute a script that is on the remote server. Is this also your experience or else can you clarify?

    We just have to provide absolute path of local script to SSH command.
    $ ssh [email protected] ./system-info.sh

  4. Fuseteam says:

    uh ssh-pass looks like a bad idea, or perhaps an incorrect usage?
    the way you presented it the actual password or the name of the password file or the name of the env variable will be logged in the command history !!!
    ssh via private and public key is way more secure as long as you keep your privatekey……..private

Leave a Reply

Your email address will not be published. Required fields are marked *