LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-12-2012, 01:50 AM   #1
sanjay87
Member
 
Registered: Oct 2011
Posts: 164

Rep: Reputation: Disabled
Rsync .scp ssh password in single command


Hi everyone,

Im trying to download the folder from my remote system using rsync but it prompting for password.How can i enable password in a single line for rsync.I also tried using scp ,I Could int find the password to pass on single line.Can anyone help me how can i pass the password in sync in single line.

Quote:
rsync -v -e ssh root@10.200.2.1:/backup /remotebkup
password:
Quote:
rsync --rsh="sshpass -p 'ecare2@' ssh -l root" 10.200.2.2:/var /backup/
skipping directory /var
its delivering skiiping directory

rsync --rsh="sshpass -p 123@ ssh -l root" 10.200.2.2:/opt/apps/bkup/daily/* /tmp
skipping directory cms
skipping directory conf
skipping directory css
skipping directory images
skipping directory js
skipping directory ROOT

Last edited by sanjay87; 03-12-2012 at 04:16 AM.
 
Old 03-12-2012, 07:08 AM   #2
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7 / 8
Posts: 3,572

Rep: Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612
I would suggest that rather than use a password you would be better using key-pair authentication instead and use the following in your rsync:

Code:
-e "ssh -i /path/to/keyfile"
 
Old 03-29-2012, 09:16 AM   #3
rahulps
LQ Newbie
 
Registered: Mar 2012
Posts: 3

Rep: Reputation: Disabled
I had a req to execute "scp" command by an application, So I used system(). But problem with system it wont let you enter password asked by "scp" command. So I use "sshpass" utility to pass the password and scp command in a single line. as:

sshpass -p 'password' scp user-name@scp-server-ip-address:path-of-the-file/file-name destination-location

you may need to check if target host/board has this sshpass, if no then you need to download the sshpass code build it.
 
Old 07-06-2012, 01:24 AM   #4
jsaravana87
Member
 
Registered: Aug 2011
Location: Chennai,India
Distribution: Redhat,Centos,Ubuntu,Dedian
Posts: 558
Blog Entries: 5

Rep: Reputation: Disabled
Hi

I would prefer using of root password on shell scripts is very unsecure .Prefer using ssh keygen in rsync.for more details regarding ssh keygen in rsync check the man page

http://ubuntuforums.org/showthread.php?t=238672

#man rsync

Last edited by jsaravana87; 07-06-2012 at 01:50 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Linux scp or rsync without password sanjee Linux - Server 15 09-13-2012 02:46 PM
[SOLVED] ssh scp key not working to ssh/scp without password anon091 Linux - Newbie 9 08-22-2011 04:28 PM
SSH/SCP with no password wh33t Linux - Software 11 06-09-2007 11:38 PM
single floppy+ssh+scp+nmap etc. bruse Linux - Newbie 1 10-20-2005 09:52 AM
ssh/scp without password not working Mauline Linux - Security 4 03-30-2005 09:26 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 07:56 PM.

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