SSH with password

SSH with password

Most of us have already used password-less connections in our past, consider a case where you wanted to do certain operations on another machine from your edge node with a password as a mandate.

One way is to use password-less communication established via public key handshake, today will share another way where you could not want to do password-less communication.

For this purpose, we can use sshpass utility.

How to use that:

sshpass -p your-user-pass ssh your-user@your-server-ip any-command-which-you-wanted-to-run-there

example:

sshpass -p 'pass@123' ssh root@127.0.0.1 mkdir -p /app/user/process-one/

You could use any other commands in place of mkdir where like cp mv scp etc which your own needs.

let me know if it helps you in someway.