LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-28-2016, 02:39 AM   #1
Madeeha
LQ Newbie
 
Registered: Apr 2016
Posts: 3

Rep: Reputation: Disabled
Transfer of files from local server to remote linux server


Hi,

I have to transfer file from one linux server to remote linux server through sftp protocol.
I am able to do it through ssh and sftp commands.
But the problem is , every time when I do, remote server password is asked.
How can we bypass password prompt?
Generation of keys and changing any parameter in config files are not permitted.
Please help me on this.

Thanks.
 
Old 04-28-2016, 02:45 AM   #2
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_10{.0|.1|.2}
Posts: 4,506
Blog Entries: 6

Rep: Reputation: 2422Reputation: 2422Reputation: 2422Reputation: 2422Reputation: 2422Reputation: 2422Reputation: 2422Reputation: 2422Reputation: 2422Reputation: 2422Reputation: 2422
Quote:
Originally Posted by Madeeha View Post
I have to transfer file from one linux server to remote linux server through sftp protocol.
I am able to do it through ssh and sftp commands.
But the problem is , every time when I do, remote server password is asked.
How can we bypass password prompt?
Generation of keys and changing any parameter in config files are not permitted.
Please help me on this.
Well then it sounds like SSH is doing its job!

If you could bypass authentication it wouldn't be much good would it?
 
Old 04-28-2016, 03:24 AM   #3
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 1,347

Rep: Reputation: 227Reputation: 227Reputation: 227
Wink

Quote:
Originally Posted by Madeeha View Post
Hi,

I have to transfer file from one linux server to remote linux server through sftp protocol.
I am able to do it through ssh and sftp commands.
But the problem is , every time when I do, remote server password is asked.
How can we bypass password prompt?
Generation of keys and changing any parameter in config files are not permitted.
Please help me on this.

Thanks.
If it is okay to zip or tar the files, you can use Tar command to transfer the files to the remote server it will not ask for any password.

But of course after you copy you need to unzip or extract the files, that's where inconvenience arises but if it's okay for you to do it then I guess you will be able to copy even vice versa without any prompting of password..

check out this link: http://quickbytesstuff.blogspot.sg/2...to-remote.html
 
Old 04-28-2016, 04:53 AM   #4
Madeeha
LQ Newbie
 
Registered: Apr 2016
Posts: 3

Original Poster
Rep: Reputation: Disabled
Unhappy

I am trying to copy tar from local to remote, still the password is being asked.
Steps followed:
a) tar file
b) Through put command of sftp transferring file to remote server

Any clue ?
 
Old 04-28-2016, 05:03 AM   #5
descendant_command
Senior Member
 
Registered: Mar 2012
Posts: 1,510

Rep: Reputation: 394Reputation: 394Reputation: 394Reputation: 394
You use a password or keys, there is no other "clue".
 
Old 04-28-2016, 05:06 AM   #6
Teufel
Member
 
Registered: Apr 2012
Distribution: Gentoo
Posts: 576

Rep: Reputation: 135Reputation: 135
sshpass
 
1 members found this post helpful.
Old 04-28-2016, 05:30 AM   #7
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 1,347

Rep: Reputation: 227Reputation: 227Reputation: 227
Cool

Quote:
Originally Posted by Madeeha View Post
I am trying to copy tar from local to remote, still the password is being asked.
Steps followed:
a) tar file
b) Through put command of sftp transferring file to remote server

Any clue ?

What command did you type?

Did you do something like this: tar cvzf - /path_to/local/folder | ssh @ "dd of=/path_on/remote/server/file_name_data.tar.gz"

Last edited by JJJCR; 04-28-2016 at 05:31 AM. Reason: edit
 
Old 04-28-2016, 05:38 AM   #8
Madeeha
LQ Newbie
 
Registered: Apr 2016
Posts: 3

Original Poster
Rep: Reputation: Disabled
Unhappy

Where should I give remote server user name and IP in this command?

Quote:
Originally Posted by JJJCR View Post
What command did you type?

Did you do something like this: tar cvzf - /path_to/local/folder | ssh @ "dd of=/path_on/remote/server/file_name_data.tar.gz"
 
Old 04-28-2016, 05:55 AM   #9
JJJCR
Senior Member
 
Registered: Apr 2010
Posts: 1,347

Rep: Reputation: 227Reputation: 227Reputation: 227
Cool

Quote:
Originally Posted by Madeeha View Post
Where should I give remote server user name and IP in this command?

tar cvzf - /IP Address of local server/local_folder | ssh <remote_user_name>@<remote_IP> "dd of=/Remote Server_path/remote_local_folder/file_name_data.tar.gz"


please do a test of a dummy data before running the production data

Good luck!!

Last edited by JJJCR; 04-28-2016 at 10:14 PM. Reason: edit
 
Old 04-28-2016, 06:11 AM   #10
Turbocapitalist
Senior Member
 
Registered: Apr 2005
Distribution: Ubuntu, Devuan, OpenBSD
Posts: 2,643
Blog Entries: 3

Rep: Reputation: 1160Reputation: 1160Reputation: 1160Reputation: 1160Reputation: 1160Reputation: 1160Reputation: 1160Reputation: 1160Reputation: 1160
Quote:
Originally Posted by JJJCR View Post
tar cvzf - /IP Address of local server/local_folder | ssh @ "dd of=/IP of Remote Server/remote_local_folder/file_name_data.tar.gz"
Or there is a variant of that, untarring at the same time:

Code:
tar zcf - ./somedir/ | ssh maheeda@server.example.com 'cd /somewhere/; tar zxf -'
That avoids dd.

But Madeeha asked about using only the SFTP protocol. So another option would be to use sshfs from the client side and then just do the copy as normal using cp, tar, or rsync.

SFTP should work with keys though and keys do not change the sshd server's configuration. In fact, the default is for sshd to allow keys. So ~/.ssh/authorized_keys could be set on the target machine to allow keys.
 
Old 04-28-2016, 07:30 AM   #11
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 8,629
Blog Entries: 4

Rep: Reputation: 2999Reputation: 2999Reputation: 2999Reputation: 2999Reputation: 2999Reputation: 2999Reputation: 2999Reputation: 2999Reputation: 2999Reputation: 2999Reputation: 2999
Why not just use rsync?

rsync -azv --rsh=ssh this_system:fileset tha_system:fileset

rsync is a "file synchronization" engine, and it contains the whole shinola: compression, synchronization, uses "ssh." It can copy between two remotes, between local and remote or vice-versa, and it automagically figures out what to copy. Its purpose is to "make that directory over-there look like this directory over-here."
 
  


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
Creating a .tgz archive on a remote server from local files? Ltes Linux - Newbie 1 01-09-2012 06:53 PM
comparing size of directories/file of remote linux server with local linux server cnt Linux - Server 4 08-03-2011 02:33 AM
user in remote LDAP server to be used to authenticate Local Linux server saravananp Linux - Newbie 5 01-11-2011 10:02 PM
How do I dial in to a remote server and transfer files? yilez Linux - Networking 1 05-18-2004 11:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:28 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration