Running a sudo command through SSH

Sometimes you may want to run a command on a remote machine that requires root level permissions.  This can be done with SSH with the -t flag to force a psuedo tty

ssh -t remote-server '/path/to/command'

Make sure to single quotes are part of your command.  You will be prompted for the user password and then the sudo password.

jhudgins has written 32 articles

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>