Skip to main content
No need for "touch", the echo command will create the file.
Source Link
terdon
  • 252.2k
  • 69
  • 480
  • 718

On Debian-based distributions, the sshpass package provides an easier way of doing what you want. The package is available for many other popular distributions. You need to set it up first:

touchecho passwordFile.txt
chmod'YourPassword' 600> passwordFile.txt
echo 'YourPassword'chmod >600 passwordFile.txt

Then invoke the SSH command from a script like this:

sshpass -f /path/to/passwordFile.txt /usr/bin/ssh -p 8484 [email protected]

This provides more flexibility, such as if you're using a different locale or need to change the password, than solutions using expect.

On Debian-based distributions, the sshpass package provides an easier way of doing what you want. The package is available for many other popular distributions. You need to set it up first:

touch passwordFile.txt
chmod 600 passwordFile.txt
echo 'YourPassword' > passwordFile.txt

Then invoke the SSH command from a script like this:

sshpass -f /path/to/passwordFile.txt /usr/bin/ssh -p 8484 [email protected]

This provides more flexibility, such as if you're using a different locale or need to change the password, than solutions using expect.

On Debian-based distributions, the sshpass package provides an easier way of doing what you want. The package is available for many other popular distributions. You need to set it up first:

echo 'YourPassword' > passwordFile.txt
chmod 600 passwordFile.txt

Then invoke the SSH command from a script like this:

sshpass -f /path/to/passwordFile.txt /usr/bin/ssh -p 8484 [email protected]

This provides more flexibility, such as if you're using a different locale or need to change the password, than solutions using expect.

Source Link
likeitlikeit
  • 2.4k
  • 1
  • 15
  • 7

On Debian-based distributions, the sshpass package provides an easier way of doing what you want. The package is available for many other popular distributions. You need to set it up first:

touch passwordFile.txt
chmod 600 passwordFile.txt
echo 'YourPassword' > passwordFile.txt

Then invoke the SSH command from a script like this:

sshpass -f /path/to/passwordFile.txt /usr/bin/ssh -p 8484 [email protected]

This provides more flexibility, such as if you're using a different locale or need to change the password, than solutions using expect.