diff --git a/internal/client/connection_aws_ssm.go b/internal/client/connection_aws_ssm.go index 8b6c747..825410b 100644 --- a/internal/client/connection_aws_ssm.go +++ b/internal/client/connection_aws_ssm.go @@ -25,7 +25,8 @@ func (a *AWSSSMConnection) Info() string { } func (a *AWSSSMConnection) User() string { - return "root" + out, _ := a.Command([]string{"whoami"}) + return strings.TrimSpace(string(out)) } func (a *AWSSSMConnection) Connect() error { @@ -108,7 +109,6 @@ func (a *AWSSSMConnection) CopyFile(localPath string, remotePath string) error { encodedContent := base64.StdEncoding.EncodeToString(fileContent) cmd := fmt.Sprintf("echo -n %s | base64 -d > %s", encodedContent, remotePath) - cmdLine := []string{"sh", "-c", "\"" + cmd + "\""} - _, err = a.Command(cmdLine) + _, err = a.Command([]string{cmd}) return err } diff --git a/internal/provider/instance_client.go b/internal/provider/instance_client.go index 6f6f78f..fab7aa9 100644 --- a/internal/provider/instance_client.go +++ b/internal/provider/instance_client.go @@ -220,7 +220,7 @@ func (ic *InstanceClient) ReadStatus() (InstanceStatus, error) { func (ic *InstanceClient) bootstrap() error { return ic.doActionOnce("bootstrap", ic.cl.WorkDir, func() error { - return ic.runScript("bootstrap", ic.data.System.Bootstrap, ic.cl.WorkDir) + return ic.runScript("bootstrap", ic.data.System.Bootstrap, ".") }) }