copying files between asterisk boxes under program control
Can some guru help me out with a command line instruction that will copy a file from one box to another, in a standard ACID installation? The boxes are behind a common router and have different port numbers for SSH (of course). If any config files changes are required, please show what is needed. Secondly If possible, is there a way to direct the output of this transfer to "stdin" so that it can go directly into another program? Thanks Ken
Thanks for the initial replies, but this is a guru-to-linux_learner question. I need specifics. I spent 5 hours spelunking the internet and reading man pages, before posting here. I tried everything I could think of and I came close once, but crashed and burned. You will note that these copying tools never have a place for password and usually no port reference. My conclusion is that all these tools/utilities require some setup of SSH - otherwise I get "connection refused" or maybe nothing at all. There is also the option to run a daemon, something I would like to avoid. I went into /etc/ssh/ssh_config and changed the port number that user-programs use - to 200 - for both machines. That does work, since the error message now has port 200 in it instead of 22. ssh: connect to host 192.168.1.110 port 200: Connection refused But ssh_config has a lot of other stuff in it (# indicates the default): # Host * # ForwardAgent no # ForwardX11 no # RhostsRSAAuthentication no # RSAAuthentication yes # PasswordAuthentication yes # HostbasedAuthentication no # BatchMode no # CheckHostIP yes # AddressFamily any # ConnectTimeout 0 # StrictHostKeyChecking ask # IdentityFile ~/.ssh/identity # IdentityFile ~/.ssh/id_rsa # IdentityFile ~/.ssh/id_dsa Port 200 # Protocol 2,1 # Cipher 3des # Ciphers aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc # EscapeChar ~ # Tunnel no # TunnelDevice any:any # PermitLocalCommand no That's why I need to hear from somebody who has actually done this (or a variation on it) and actually gotten it to work. Thanks! 73 Ken From: app_rpt-users-bounces@ohnosec.org [mailto:app_rpt-users-bounces@ohnosec.org] On Behalf Of Ken Sent: Saturday, April 09, 2011 5:33 PM To: app_rpt-users@ohnosec.org Subject: [App_rpt-users] copying files between asterisk boxes under program control Can some guru help me out with a command line instruction that will copy a file from one box to another, in a standard ACID installation? The boxes are behind a common router and have different port numbers for SSH (of course). If any config files changes are required, please show what is needed. Secondly If possible, is there a way to direct the output of this transfer to "stdin" so that it can go directly into another program? Thanks Ken
On Sat, Apr 9, 2011 at 5:59 PM, Ken <ke2n@cs.com> wrote:
Thanks for the initial replies, but this is a guru-to-linux_learner question. I need specifics.
I spent 5 hours spelunking the internet and reading man pages, before posting here.
I tried everything I could think of and I came close once, but crashed and burned.
You will note that these copying tools never have a place for password and usually no port reference.
My conclusion is that all these tools/utilities require some setup of SSH – otherwise I get “connection refused” or maybe nothing at all. There is also the option to run a daemon, something I would like to avoid.
I went into /etc/ssh/ssh_config and changed the port number that user-programs use - to 200 - for both machines. That does work, since the error message now has port 200 in it instead of 22.
ssh: connect to host 192.168.1.110 port 200: Connection refused
But ssh_config has a lot of other stuff in it (# indicates the default):
# Host *
# ForwardAgent no
# ForwardX11 no
# RhostsRSAAuthentication no
# RSAAuthentication yes
# PasswordAuthentication yes
# HostbasedAuthentication no
# BatchMode no
# CheckHostIP yes
# AddressFamily any
# ConnectTimeout 0
# StrictHostKeyChecking ask
# IdentityFile ~/.ssh/identity
# IdentityFile ~/.ssh/id_rsa
# IdentityFile ~/.ssh/id_dsa
Port 200
# Protocol 2,1
# Cipher 3des
# Ciphers aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc
# EscapeChar ~
# Tunnel no
# TunnelDevice any:any
# PermitLocalCommand no
That’s why I need to hear from somebody who has actually done this (or a variation on it) and actually gotten it to work.
Thanks!
73
Ken
*From:* app_rpt-users-bounces@ohnosec.org [mailto: app_rpt-users-bounces@ohnosec.org] *On Behalf Of *Ken *Sent:* Saturday, April 09, 2011 5:33 PM *To:* app_rpt-users@ohnosec.org *Subject:* [App_rpt-users] copying files between asterisk boxes under program control
Can some guru help me out with a command line instruction that will copy a file from one box to another, in a standard ACID installation?
The boxes are behind a common router and have different port numbers for SSH (of course). If any config files changes are required, please show what is needed.
Secondly
If possible, is there a way to direct the output of this transfer to “stdin“ so that it can go directly into another program?
Thanks
Ken
_______________________________________________ App_rpt-users mailing list App_rpt-users@ohnosec.org http://ohnosec.org/cgi-bin/mailman/listinfo/app_rpt-users
Hi Ken,
Did you change your SSH port on the ACID systems from their default of 222 to 200? Port 222 is the default port set by ACID. Assuming you can get SSH working between the boxes, you can use SCP (secure copy) to copy between them. 73's, Keith
On Sun, 10 Apr 2011 09:59:48 Ken wrote: <snip>
Can some guru help me out with a command line instruction that will copy a file from one box to another, in a standard ACID installation?
The boxes are behind a common router and have different port numbers for SSH (of course). If any config files changes are required, please show what is needed.
Here's a tutorial that may help. The fourth point mentions how to specify a port. http://www.linuxtutorialblog.com/post/ssh-and-scp-howto-tips-tricks
Secondly
If possible, is there a way to direct the output of this transfer to "stdin" so that it can go directly into another program?
Yes, you use ssh for this (not scp). Here's how: http://gnuru.org/article/1522/copying-with-scp-stdin Have fun! 73, Andrew
Secondly
If possible, is there a way to direct the output of this transfer to "stdin" so that it can go directly into another program?
Yes, you use ssh for this (not scp). Here's how:
Yes OK - but I want it to go the stdin of the program running on the remote box. This is the box that is fetching the data/file. That means scp needs to send its file data to STDOUT (which would then be piped into the next program) Ken
On Sat, Apr 9, 2011 at 8:35 PM, Ken <ke2n@cs.com> wrote:
Secondly
If possible, is there a way to direct the output of this transfer to "stdin" so that it can go directly into another program?
Yes, you use ssh for this (not scp). Here's how:
Yes OK - but I want it to go the stdin of the program running on the remote box.
I don't know of a way to do what you want to do but I think I'm detecting a misunderstanding about the way ssh/scp works. There are two sides to a ssh/scp connection..the client side and the server side. The client side is implemented with various programs such as PuTTY for Windows and ssh for Linux. There are many others. The server side on Linux is implemented using a program called (typically) sshd. The are various distributions of the server side for Linux such as OpenSSH, Dropbear, and others. When you connect from system A to system B using ssh (or scp), you are making a connection between the client program (such as ssh) on system A and the server program, sshd, on system B. It is not possible to connect ssh on system A to ssh on system B. The client side program, by necessity, allows for many different configurations that you can quickly switch between, to talk to any given remote system's server program. The server program (e.g. sshd), is configured for a single port. The server program doesn't typically have a nice user interface like the client since it is configured fairly statically and just listens for remote connection attempts on it's configured port.
From my reading of your email, it seems you are setting up the client on system A to initiate connection attempts using port 200. Then likewise, you are setting up the client on system B to initiate connection attempts using port 200. However the clients don't talk to each other..they talk to the remote systems server (sshd), which is configured differently (probably port 222). To configure the sshd server on each system, consult the manpage for sshd on that system.
In terms of what you are trying to achieve, it seems you want an option within sshd that passes file streams to stdout so that you can pipe that received file stream into a second program via stdin. I've looked through OpenSSH's implementation of sshd and nothing jumped out at me that would allow you to do that. Regards, Keith KF7DRV
This is the box that is fetching the data/file. That means scp needs to send its file data to STDOUT (which would then be piped into the next program)
Ken
_______________________________________________ App_rpt-users mailing list App_rpt-users@ohnosec.org http://ohnosec.org/cgi-bin/mailman/listinfo/app_rpt-users
On Sun, 10 Apr 2011 12:35:31 you wrote:
Secondly
If possible, is there a way to direct the output of this transfer to "stdin" so that it can go directly into another program?
Yes, you use ssh for this (not scp). Here's how:
Yes OK - but I want it to go the stdin of the program running on the remote box. This is the box that is fetching the data/file. That means scp needs to send its file data to STDOUT (which would then be piped into the next program)
No, you can't do that with scp, but you can do it with ssh, as described in the article. Like this: echo "some text" | ssh user@remote.host "cat > /remote/file" In this case, echo is writing to stdout. It is piped to ssh, which establishes a connection to remotehost. The other end of the pipe becomes stdout on remotehost, which connects to stdin of cat which dumps *its* stdout to a file. So, replace echo with your program on localhost which is producing data to stdout, and cat with your program on remotehost which is consuming data on stdin. Are you transferring a stream of data, or just a file? It's been I while since I had to do this, but I seem to remember it is a little counterintuitive. HTH, A
So, replace echo with your program on localhost which is producing data to stdout, and cat with your program on remotehost which is consuming data on stdin.
Are you transferring a stream of data, or just a file?
Andrew, apparently I still have not communicated this last part correctly. My program - running on local host - is consuming data, not producing data. The data is an mp3 file on remote host. (We are going to turn that into a stream, but remote host doesn't know about that). You have forced me to think about things differently however (outside the box, in fact). One alternate approach would be install my streaming program on remote host. Then the file it needs would be found locally. Tnx Ken
On Sun, 10 Apr 2011 21:08:37 you wrote:
Andrew, apparently I still have not communicated this last part correctly.
Sorry. It was either not clear or I didn't understand.
My program - running on local host - is consuming data, not producing data. The data is an mp3 file on remote host. (We are going to turn that into a stream, but remote host doesn't know about that).
You have forced me to think about things differently however (outside the box, in fact). One alternate approach would be install my streaming program on remote host. Then the file it needs would be found locally.
Tnx Ken
How about an ssh tunnel? http://www.revsys.com/writings/quicktips/ssh-tunnel.html Does this stream really need to be encrypted? 73, Andrew
Does this stream really need to be encrypted?
73,
Andrew
No it does not - but the local program needs to log into the remote system and, unless you do something special, that requires a password. I am learning that SSH provides a way to do that without flogging the password around in plain text. That's the bit where encryption is involved/needed. 73 Ken
Hey Ken, KI6PSP did all the work for the ARRL news feed. http://ki6psp.blogspot.com/ David On Sun, Apr 10, 2011 at 10:32 AM, Ken <ke2n@cs.com> wrote:
Does this stream really need to be encrypted?
73,
Andrew
No it does not - but the local program needs to log into the remote system and, unless you do something special, that requires a password. I am learning that SSH provides a way to do that without flogging the password around in plain text. That's the bit where encryption is involved/needed. 73 Ken
_______________________________________________ App_rpt-users mailing list App_rpt-users@ohnosec.org http://ohnosec.org/cgi-bin/mailman/listinfo/app_rpt-users
participants (4)
-
Andrew Errington -
David KE6UPI -
Keith Williamson -
Ken