Skip to content

yusys-cloud/go-ssh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go-SSH

Simple ssh client with go

Execute command

import "github.com/yusys-cloud/go-ssh"

client,err:=ssh.NewSSHClient("host", "root", "passwd")

stdout, stderr, err := client.ExecuteCmd("pwd")

Execute command with private key

client, err:=ssh.NewSSHClientWithKey("host","root","/Users/user/.ssh/id_rsa")
stdout, stderr, err := client.ExecuteCmd("pwd")

File upload

client.UploadFile("/tmp/test.html", "/root/test/test.html")

Note: Source file contents are fully read in memory, so you should not upload very large files using this command. If you really need to upload huge file to a lot of hosts, try using bittorrent or UFTP, as they provide much higher network effeciency than SSH.

About

Simple ssh client with go

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages