SCP in Golang

3,027 views
Skip to first unread message

Ajay Bodhe

unread,
Apr 10, 2015, 4:48:23 AM4/10/15
to golan...@googlegroups.com
Hello,

I want to write a small program in GO-Lang that will first SCP a file from remote machine & delete the file from remote machine.
Please provide references to the sample programs/packages.

Thanks.
 

Jedy

unread,
Apr 10, 2015, 5:56:05 AM4/10/15
to Ajay Bodhe, golan...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dave Cheney

unread,
Apr 10, 2015, 6:01:50 AM4/10/15
to golan...@googlegroups.com

Ajay Bodhe

unread,
Apr 10, 2015, 8:18:59 AM4/10/15
to golan...@googlegroups.com
@Jedy,
How can I reuse your code to scp file using username, password OR using passwordless ssh?
Also I am not clear what is the use of goroutine inside main?
What if I just want to execute a command like this - scp unsername@ip_addrs:/home/user/filename /tmp/ ?


Thanks.

James Bardin

unread,
Apr 10, 2015, 9:53:22 AM4/10/15
to golan...@googlegroups.com


On Friday, April 10, 2015 at 8:18:59 AM UTC-4, Ajay Bodhe wrote:
@Jedy,
How can I reuse your code to scp file using username, password OR using passwordless ssh?
Also I am not clear what is the use of goroutine inside main?

scp is a program/protocol that happens to use ssh as a transport. You setup the authentication completely with the ssh package. The example was just showing how to exec the remote scp, and write the protocol directly to the ssh channel. 


What if I just want to execute a command like this - scp unsername@ip_addrs:/home/user/filename /tmp/ ?

It may be easier for you to exec that command directly (provided you use publickey authentication). 


Gyu-Ho Lee

unread,
Apr 10, 2015, 3:14:54 PM4/10/15
to golan...@googlegroups.com

Sam Freiberg

unread,
Apr 10, 2015, 3:29:15 PM4/10/15
to Ajay Bodhe, golang-nuts

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ajay Bodhe

unread,
Apr 11, 2015, 4:35:26 AM4/11/15
to golan...@googlegroups.com
Thanks All for the help.
This community is awesome (y).


On Friday, 10 April 2015 14:18:23 UTC+5:30, Ajay Bodhe wrote:

gerald...@gmail.com

unread,
Jun 2, 2015, 7:09:39 PM6/2/15
to golan...@googlegroups.com
How can you automatically start the app after the scp transfer?

gerald...@gmail.com

unread,
Jun 3, 2015, 4:47:50 AM6/3/15
to golan...@googlegroups.com, gerald...@gmail.com
fixed!
Reply all
Reply to author
Forward
0 new messages