Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
I am trying to use ssh and login to a different mac (B) from my mac (A) but do not know B's password. Is there anyway of finding B's password or doing this without access to B?
No, there's no way to do that. Without having access to the other mac you cannot place your key in order to log in.
You would have to have prior knowledge of the password otherwise.