Login without PWD is fast and efficient. Running commands in server from local machine also have these benefits.
login without PWD: add PC A’s public key to PC B’s authorized keys.
Run command remotely
ssh root@MachineB "ls"
NOTE: running commands remotely is dangerous since there might be some ENVIRONMENT conflicts.
ssh-copy-id can replace the manual way of the adding the public key to a remote account’s authorized_keys:
$ ssh-copy-id b@B
Sure, it works. Thank you for comments.