How can I add password of user as alias in bashrc file?
15,182
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"
Related videos on Youtube
![Ramesh Kumar](https://i.stack.imgur.com/BYBfk.jpg?s=256&g=1)
Comments
-
Ramesh Kumar almost 2 years
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?
-
Abhinav Ravi about 5 yearsFor Mac : Install "sshpass" using "brew install raw.githubusercontent.com/kadwanev/bigboybrew/master/Library/…"
-
ankit about 5 yearsWhy it's not a good thing?
-
Ravexina almost 5 yearsI'm user (A), there is a user (B) using the same machine. I can use
cat /home/b/.bashrc
to see what B got there. -
roottraveller almost 5 yearsthis is not working on my mac. any idea
-
Andhi Irawan over 4 yearsnot working in Ubuntu