0

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?

thanks.

user2236185
  • 103
  • 3
  • 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: http://superuser.com/questions/8077/how-do-i-set-up-ssh-so-i-dont-have-to-type-my-password/8110 – Paul Jul 09 '15 at 04: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 09 '15 at 04:15
  • 1
    Because it is using private keys. See the link. – Paul Jul 09 '15 at 04: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 09 '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 09 '15 at 13:15

1 Answers1

1
  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.

Archemar
  • 1,687
  • 2
  • 16
  • 20