diff options
| author | Shulhan <m.shulhan@gmail.com> | 2020-06-26 07:21:58 +0700 |
|---|---|---|
| committer | Shulhan <m.shulhan@gmail.com> | 2020-06-26 07:21:58 +0700 |
| commit | 5dfcef1eaba4b8563a7eb2865d28bf45be282f23 (patch) | |
| tree | 9ea3346fde7bfb79468719665bf4f2a1a77b867b /command.go | |
| parent | f370c2a598d3b4482e2d391458fc6878fada49af (diff) | |
| download | awwan-5dfcef1eaba4b8563a7eb2865d28bf45be282f23.tar.xz | |
environment: set the SSH key, user, host, and port
By knowing this values, user can use it to invoke other SSH related
command, for example to copy file using `scp`
scp -i {{.SSHKey}} src {{.SSHUser}}@{{.SSHHost}}:{{.SSHPort}}/dst
Diffstat (limited to 'command.go')
| -rw-r--r-- | command.go | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -401,4 +401,9 @@ func (cmd *Command) initSSHClient() { if err != nil { log.Fatal("cmd: cannot create new SSH client: " + err.Error()) } + + cmd.env.SSHKey = sshSection.IdentityFile[0] + cmd.env.SSHUser = sshSection.User + cmd.env.SSHHost = sshSection.Hostname + cmd.env.SSHPort = strconv.Itoa(sshSection.Port) } |
