LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This 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


Reply
  Search this Thread
Old 06-10-2014, 09:22 PM   #1
jbruyet
Member
 
Registered: Feb 2011
Location: North Central Washington
Distribution: Debian, OpenSUSE, Kali, Ubuntu
Posts: 178

Rep: Reputation: 7
Need the password included in the script


Hey all, I'm trying to find a way to copy files to a couple of my servers throughout the day using a script. Doing it in Windows was quite easy but I'm baffled as to how to do it in Linux. The part that I can't figure out is how to pass the password to the remote server. I'm using a generic scp command:

Code:
scp *.* jobee@192.168.1.7:/mnt/bigdrive/Backups
How do I include the password so the script will work without user intervention? Googling this is no help. Well, there was one hit that looked like it might do what I wanted it to do but after I got to the third page I decided to post a question here. Is this possible? If so, how?

Thanks,

Joe B
 
Old 06-10-2014, 09:36 PM   #2
jbruyet
Member
 
Registered: Feb 2011
Location: North Central Washington
Distribution: Debian, OpenSUSE, Kali, Ubuntu
Posts: 178

Original Poster
Rep: Reputation: 7
I found a program called sshpass, but there are several versions of the rpm. I'll jump in and see what happens.

Thanks,

Joe B
 
Old 06-10-2014, 11:05 PM   #3
jbruyet
Member
 
Registered: Feb 2011
Location: North Central Washington
Distribution: Debian, OpenSUSE, Kali, Ubuntu
Posts: 178

Original Poster
Rep: Reputation: 7
Yep, I'm using sshpass like this:

Code:
sshpass -p 'password' scp -r /home/jobee/Documents/* root@192.168.1.7:/mnt/bigdrive/Backups/Docs
and it works like a charm (you need the single-quotes). Here's the page I finally found that helped me get it working:

http://www.cyberciti.biz/faq/noninte...word-provider/

Thanks,

Joe B
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
command should take password from script itself rohitchauhan Programming 1 04-25-2013 06:54 AM
Booting windows 7 after hard drive removal (Boot Info Script results included) briced Linux - Hardware 17 01-05-2012 07:31 AM
password script wincrk Linux - General 4 04-25-2006 10:16 PM
Help password script jamin123 Linux - Security 1 02-07-2006 08:56 PM
Shell Script For Password cpope67 Programming 4 01-10-2005 02:16 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration