fix: split su command into separate args for ttyd

Made-with: Cursor
This commit is contained in:
stswangzhiping
2026-03-16 16:21:11 +08:00
parent 9dc559a43a
commit 5f5b976f5b

View File

@@ -121,8 +121,7 @@ async function startTtyd() {
const shell = fs.existsSync('/bin/bash') ? '/bin/bash' : '/bin/sh'; const shell = fs.existsSync('/bin/bash') ? '/bin/bash' : '/bin/sh';
// 以普通用户身份启动 shell与 SSH 登录一致) // 以普通用户身份启动 shell与 SSH 登录一致)
const ttydUser = process.env.CLAWD_TTY_USER || 'sts'; const ttydUser = process.env.CLAWD_TTY_USER || 'sts';
const loginCmd = `/bin/su - ${ttydUser}`; const proc = spawn(TTYD_BIN, ['-p', String(TTYD_PORT), '-i', '127.0.0.1', '-W', '-t', 'cursorBlink=true', '/bin/su', '-', ttydUser], {
const proc = spawn(TTYD_BIN, ['-p', String(TTYD_PORT), '-i', '127.0.0.1', '-W', '-t', 'cursorBlink=true', loginCmd], {
stdio: 'ignore', stdio: 'ignore',
detached: true, detached: true,
}); });