If you need to run a command on a remote server via ssh, you can create a pseudo TTY with ssh -t
The -t option in the ssh -t command force pseudo-tty allocation.
This is very handy when you need to run remote screen based applications on the remote server, establishing something like a “temporary” ssh connection, that will be established while the command is running, and it is closed as soon as the command is finished.
Let’s suppose you want to edit a file in the remote server.
ssh -t [user]@[remote-server] vim [file]
Once you close the remote file, the ssh session will be terminated.
Another good use, is to run htop on a remote computer.
ssh -t email@example.com htop
And it can also be used to run commands as root with the sudo command, on servers with the root account disabled like Ubuntu.
ssh -t firstname.lastname@example.org "sudo command"
You will be asked for the password of user on remote server in order to run command as root.