How to ssh as another user

What I am going to do is create an account X on my local computer. Login as account X, then ssh-keygen for account X.

No, what you're going to do is rather useless. The server doesn't know anything about your local account name (like it used to in the rsh days); the ssh client merely uses it as the default login name it'll try, and the ssh-keygen tool merely puts it in the "comment" field which isn't used for anything at all.

If you want to log in to the server as account X, just ask ssh to do so:

ssh X@myserver

This will make the server check your password or pubkey against the remote user X's information.


Does setting the -l flag not work?

i.e. $ ssh host -l username