Execute command remotely using SSH

If you are accessing your SSH using public key authentication:

sudo ssh -i key.pem ubuntu@host 'command to be executed remotely' ;

If you are accessing your SSH using username and password:

sudo ssh -u root -p ubuntu@host 'command to be executed remotely' ;

Majd Arbash

...

Leave a Reply