From 70bb66d0ab55c59be69c549c9fc5bc545a2853cc Mon Sep 17 00:00:00 2001 From: Matteo Gaggiano Date: Fri, 1 Dec 2023 09:45:29 +0100 Subject: [PATCH] wrap password that could contains apos char --- commands/commands.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/commands/commands.go b/commands/commands.go index c1424a0..8091038 100644 --- a/commands/commands.go +++ b/commands/commands.go @@ -147,9 +147,10 @@ func (cmds *Commands) createCommand(c *cli.Context, srv *host.Host, options *opt var args = make([]string, 0) if srv.Password() != "" { + var password = strings.Replace(srv.Password(), "'", "\\'", -1) args = []string{ "sshpass", - fmt.Sprintf("-p %s", srv.Password()), + fmt.Sprintf("-p '%s'", password), } }