How to pass password in shell script for scp
I have found 1 and 3 very easy to implement. In short, on all of my remote servers I have the exact same setup, which consists of a 'backup' directory in my home directory of each server.
Sure, you could mess with configuration files and hope an update won't just overwrite it again updating DSM frequently does break custom modifications. Sometimes - especially when the OP expressly writes they're already aware it's not optimal - people just need a solution.
Prabhjeet 1 4.
Learn, Share, Build
8 Sep or so the password does not show in the bash history the Putty version of scp ("
Thank you very much! Here is an example of how you do it with expect tool: Bash doesn't accept sub This is in perl, sorry i didn't write that.
SDsolar 1 2 Please show an example. Found it, and am adding C: Kevin Chui 76 4. Also, if it were me, I assume I can't alter the other server - all I want is to copy a file.
You may use ssh-copy-id to add ssh key: RomanHotsiy 1, 9 This directory will contain a public key and a private key. There will be two more files that are generated as you go along.
Pass on Passwords with scp
pscp") lets you pass the password with the -pw parameter.
If it's not there already, log into the remote host, and run ssh-keygen there too. You don't want to regenerate it.
In this file, put your public key. Then, your only hope is to use Expect or Net:: There is no command line argument you can pass to the SSH password.
How to Pass Password when using scp in Linux
That's done for security reasons. The only way around this is some sort of program that can pretend to type in the password at the prompt. Dec 9 '13 at If you want it with expectuse this script see answer Automate scp file transfer using a shell script: Manjunath D R 1 8. KunMing Xie 3 How to pass password to scp command used in bash script?
Connect through SSH and type in password automatically, without using a public key I have a bash script that makes dump of DB then copies file from one server to another but it always asks for password before connection.
This is something I really hate about many online communities; They will tell you that you are doing something stupid and then not give you the answer.
Use the tool sshpass sshpass -p 'password' scp file.SSH Using Expect Automation Scripting In Linux By Passing Password From Script
GGarciaBas 4 2. It's also the accepted answer provided on the question that this one is marked as a duplicate of Security isn't always a concern, such as during cross-platform development of a box within the firewall. I recommend reading the password from prompt once with read -s -p "Enter ssh password: The time has come And I will also recommend using a restricted shell like rssh for this user.
learn linux and unix commands - unix shell scripting
Andy 4, 16 Take a look at: Vasu 1 3 8. Right now, you're passing three parameters: UlrichSchwarz I dont know exactly. Wouldn't it be better then having your login info stored in the script file? Besides on my box I have no option -p passwd.
- Older Posts