LinuxQuestions.org
Help answer threads with 0 replies.
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 03-30-2010, 10:45 PM   #1
DaFakaMatt
LQ Newbie
 
Registered: Sep 2009
Location: Western Australia
Distribution: Debian 505 (Lenny)
Posts: 28
Blog Entries: 1

Rep: Reputation: 15
Script for scp


Hello everyone.

I'm trying to make a script to go from one machine to another so I can copy files through scp 1 at a time. Here is what I got so far:

---

DATE="/bin/date"

echo "Starting the copy: `$DATE`"

scp /home/user/$1 hostname:/home/user
sleep 1

echo "Finished the copy : `$DATE`"

---

The only thing I am looking for, is how do I make it so it will not prompt me for a password? any help is appreciated
 
Old 03-30-2010, 10:55 PM   #2
kirukan
Senior Member
 
Registered: Jun 2008
Location: Eelam
Distribution: Redhat, Solaris, Suse
Posts: 1,278

Rep: Reputation: 148Reputation: 148
Create public key for that particular user
follow the following for public key
http://sial.org/howto/openssh/publickey-auth/
 
Old 03-31-2010, 10:53 PM   #3
DaFakaMatt
LQ Newbie
 
Registered: Sep 2009
Location: Western Australia
Distribution: Debian 505 (Lenny)
Posts: 28

Original Poster
Blog Entries: 1

Rep: Reputation: 15
Thanks for the help kirukan, But I don't want to change any keys around. I want do it so for example, have a password file, so that the script looks into the password file for the password, can this be done?
 
Old 03-31-2010, 11:21 PM   #4
kirukan
Senior Member
 
Registered: Jun 2008
Location: Eelam
Distribution: Redhat, Solaris, Suse
Posts: 1,278

Rep: Reputation: 148Reputation: 148
If you keep your password in plain text somewhere in file, people not recommend this way because of security issue
 
Old 04-01-2010, 12:25 AM   #5
DaFakaMatt
LQ Newbie
 
Registered: Sep 2009
Location: Western Australia
Distribution: Debian 505 (Lenny)
Posts: 28

Original Poster
Blog Entries: 1

Rep: Reputation: 15
Hmm good point, should there be a eavesdropper, they'd be able to pick up that password... Hmmm
 
Old 04-01-2010, 01:28 AM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
You can use ssh auth keys (prob best), or lookup ssh-agent, where you login to the ssh-agent and it stores your encrypted passwd in mem, then supplies to any prog in same session that asks for it.
 
  


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
SCP script soupbone38 Programming 2 05-15-2009 05:40 PM
scp in bash script only getting to 11% just_me_then Linux - General 5 04-27-2008 03:02 AM
scp, how to pass password in script ebel.velda Linux - Software 4 07-17-2007 05:13 PM
NFS or SCP in a script rooch84 Linux - Software 7 09-01-2004 10:50 AM
using scp in a script jeempc Programming 2 08-15-2004 09:47 AM

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

All times are GMT -5. The time now is 12:18 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