Hi I have some hosts I need to ssh to, the username I use for those hosts are different then the username of the pc that I ssh from. but the password is the same, is it possible that when I ssh it will automatically use the password of the pc that I ssh from.

Also some hosts that I ssh to, have the same username and password of the computer that I ssh from. How can I tell ssh to automatically use the same password and username that I use in the pc that I ssh from?


  • 4
    Your computer doesn't know your password, it only stores an (effectively) non-reversible encrypted copy of it. If you want to automatically log in, use private keys: superuser.com/questions/8077/… – Paul Jul 9 '15 at 4:12
  • @Paul but as work,when I ssh from a computer to another computer ( when in all of them I have the same username and password ) I only do ssh and I do not need to write my password or username. – user2236185 Jul 9 '15 at 4:15
  • 1
    Because it is using private keys. See the link. – Paul Jul 9 '15 at 4:16
  • if you changed the password for your account, then your ssh might not work. Try it out. That'd show that it's not using the password for your linux user account, it's using the key ssh stored in your linux user account profile ~/.ssh/id_rsa – barlop Jul 9 '15 at 10:46
  • In SSO scenarios, it might be possible to log in to another PC using just the existing login token. The authentication server/service will vouch for your identity in that case. – Daniel B Jul 9 '15 at 13:15
  1. ssh/sshd do not use might be told to ignore unix password, by using public/private key, those keys might have password, but it is seldom the case in linux/unix world.
  2. you can change, on a per session bassis distant username with either:

    ssh -l john distant
    ssh john@distant
  3. as told in https://stackoverflow.com/questions/10197559/ssh-configuration-override-the-default-username , you can use a local config file (~/.ssh/config) to change username on a host basis.

| improve this answer | |
  • This is wrong. SSH does support password authentication in various forms. – Daniel B Jul 9 '15 at 13:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.