Skip to main content

Command Palette

Search for a command to run...

SSH with password

Published
1 min read
SSH with password
I

An developer who wanted to spread the world all the small bit of required information

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.

More from this blog

Indrajeet Gour's Blog

15 posts

Sharing the small knowledge I have to the world!! Thought of having this in place that this might help few somewhere with something they want...