One way to sudo over ssh

Example :

ssh -t user@remote "sudo command"

Open up a file with vim. The ssh session is terminated once the remote file is closed

ssh -t user@remote vim file

-t : open up a pseudo tty

Manpage ssh

Personalizing SSH config file

Host lambda
    User alpha
    IdentityFile ~/.ssh/id_example_rsa

SSH examples

Manpage ssh_config