From f1ecbd1a93b890d02183f5549af511a52b4022e0 Mon Sep 17 00:00:00 2001 From: Eugene Date: Fri, 16 Oct 2020 12:47:03 +0200 Subject: [PATCH] handle windows usernames with spaces - fixed #2944 --- terminus-ssh/src/services/ssh.service.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/terminus-ssh/src/services/ssh.service.ts b/terminus-ssh/src/services/ssh.service.ts index 0a180654..d65658d2 100644 --- a/terminus-ssh/src/services/ssh.service.ts +++ b/terminus-ssh/src/services/ssh.service.ts @@ -116,8 +116,9 @@ export class SSHService { 'ssh-keygen.exe', ) await execFile('icacls', [temp.path, '/inheritance:r']) - let sid = await execFile('whoami', ['/user', '/nh']) - sid = sid[0].split(' ')[0] + let sid = await execFile('whoami', ['/user', '/nh', '/fo', 'csv']) + sid = sid[0].split(',')[0] + sid = sid.substring(1, sid.length - 1) await execFile('icacls', [temp.path, '/grant:r', `${sid}:(R,W)`]) }