I have a problem with scp bash script. I was trying to automate scp command to copy files in and out, and I was trying to avoid key in the password myself.
So I attempt to use the "here string" feature of bash, it didn't work with scp.
And those server I am working with, they don't have expect package installed. :-(
ps. I am not supposed to change the configuration of the servers( includes setup openssh keys, or install expect)
You guys have any idea that can help this case?
Thanks & Regards,
kit393
05-03-2012, 01:20 PM
Adam Carter
SCP bash script
On Thu, May 3, 2012 at 9:44 PM, LiangYun Gong <kit393@gmail.com> wrote:
> Hi guys,
>
> I have a problem with scp bash script. I was trying to automate scp command
> to copy files in and out, and I was trying to avoid key in the password
> myself.
>
> So I attempt to use the "here string" feature of bash, it didn't work with
> scp.
>
> And those server I am working with, they don't have expect package
> installed. :-(
>
> ps. I am not supposed to change the configuration of the servers( includes
> setup openssh keys, or install expect)
Typically you would copy local:~/.ssh/id_dsa.pub (or non dsa
equivalent) into remote:~/.ssh/authorized_keys - since that's only
user level, no need for root access. Its changing the configuration of
the user on the remote machine, but since that user is you, its
usually ok.
You then use -i with scp.
05-03-2012, 03:52 PM
LiangYun Gong
SCP bash script
Right, I am just not sure that's the only way. Since I just want to copy one file in and one file out on many servers, this solution will double the work. It's just for servers auditing, you know.
But thanks a lot anyway. Appreciate you help. :-)
On Thu, May 3, 2012 at 9:20 PM, Adam Carter <adamcarter3@gmail.com> wrote:
On Thu, May 3, 2012 at 9:44 PM, LiangYun Gong <kit393@gmail.com> wrote:
> Hi guys,
>
> I have a problem with scp bash script. I was trying to automate scp command
> to copy files in and out, and I was trying to avoid key in the password
> myself.
>
> So I attempt to use the "here string" feature of bash, it didn't work with
> scp.
>
> And those server I am working with, they don't have expect package
> installed. :-(
>
> ps. I am not supposed to change the configuration of the servers( includes
> setup openssh keys, or install expect)
Typically you would copy local:~/.ssh/id_dsa.pub (or non dsa
equivalent) into remote:~/.ssh/authorized_keys - since that's only
user level, no need for root access. Its changing the configuration of
the user on the remote machine, but since that user is you, its
usually ok.
You then use -i with scp.
05-04-2012, 12:28 AM
Joshua Murphy
SCP bash script
On Thu, May 3, 2012 at 7:44 AM, LiangYun Gong <kit393@gmail.com> wrote:
> Hi guys,
>
> I have a problem with scp bash script. I was trying to automate scp command
> to copy files in and out, and I was trying to avoid key in the password
> myself.
>
> So I attempt to use the "here string" feature of bash, it didn't work with
> scp.
>
> And those server I am working with, they don't have expect package
> installed. :-(
>
> ps. I am not supposed to change the configuration of the servers( includes
> setup openssh keys, or install expect)
>
> You guys have any idea that can help this case?
>
> Thanks & Regards,
> kit393
Well, expect is generally used client-side and doesn't require a
server-side counterpart, assuming you're pulling files to, or pushing
from, a machine you do have actual control of. SSH keys are the usual
means, since they don't involve writing a password somewhere in plain
text, but lacking those, expect on your own machine would do the
trick.