Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I can get scp to send a file interactively where I get prompted for the server password.
If I try using sshpass in a bash script it fails. No error messages, it just doesn't show up.
Both machines are Linux Mint 19.2 running the Mate desktop.
Both ssh and sshpass were downloaded from the repository. I installed openssh on both machines some time ago. I installed sshpass within the last few days on the sending machine only. Both machines are sitting on a home network
Have they taken this ability away from me. I did this a few years ago and it worked.
I do not need high security on my own private network. I just want a simple way to
move files between computers.
sshpass works for me from both command line and a bash script running debian as the client. Just for a frame of reference does sshpass work if just using ssh?
#!/bin/bash
set -x
shpass -p 'MyPass' scp /home/terry/Documents/fpc/Test/MyFile.txt terry@192.168.0.100:/home/terry/Documents/fpc/Test/
# I also tried
# Cmd="shpass -p 'MyPass' scp /home/terry/Documents/fpc/Test/MyFile.txt terry@192.168.0.100:/home/terry/Documents/fpc/Test/"
# echo `$Cmd`
#Which also did not work
#This is a very simple script, I was going to execute it from a Pascal Program.
#I had also tried using Pascal's TProcess
#ScpProcess := TProcess.create(Nil);
#ScpProcess.Executable := 'sshpass';
#ScpProcess.Parameters.Add('-p');
#ScpProcess.Parameters.Add('''MyPass''');
#ScpProcess.Parameters.Add('scp');
#ScpProcess.Parameters.Add('ScpExample.pas');
#ScpProcess.Parameters.Add('terry@192.168.0.100:/home/terry/Documents/fpc/Test/');
#ScpProcess.Options := ScpProcess.Options + [poWaitOnExit];
#ScpProcess.Execute;
#Again, no errors, but the file was not copied.
#So I am kind of running out of ideas.
#!/bin/bash
set -x
shpass -p 'MyPass' scp /home/terry/Documents/fpc/Test/MyFile.txt terry@192.168.0.100:/home/terry/Documents/fpc/Test/
I copied the above line, modified shpass to sshpass, editited the password for my remote system, and edited the IP address to match my home network. I had to create a MyFile.txt as a test file. I also shortened the path to MyFile.txt on both ends. I gave the script a name of testcopy and made it executable. I ran the command sh testcopy, and got the following output.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.