1

I have created alias for username and it works fine

alias yb="ssh name@hostname"

It works fine, but I also want to create alias for password, Can anyone help how can I do this?

  • 1
    What is "alias for password"? – Tomasz Jakub Rup May 17 '17 at 17:41
  • 2
    Why don't you use keys instead? – PaterSiul May 17 '17 at 19:25
  • password is too long and need to enter in multiple terminals.. – Ramesh Kumar May 18 '17 at 15:45
6

Before we start, it's not a good thing to do... you should use ssh keys instead!

You can use sshpass, it's a non-interactive ssh password authentication.

Install it using your package manager, for example in Debian based distributions:

sudo apt install sshpass

then in your bashrc:

alias yb="sshpass -p password_in_plain_text ssh name@hostname"

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.