Run a remote command using ssh config file

remote controlssh

I'd like to be able to setup a command to run on ssh login to a server, without needing to type it.
Basically I'm looking for the ssh config file equivalent of:

ssh host command

so that all I need to type is:

ssh host

and the command gets run.

Best Answer

You cold solve this in your .ssh/config file, for the host where you want to execute a command, add

  RequestTTY yes
  RemoteCommand <some command>

where <some command> is your command. This also works with screen or tmux.