fix: run ttyd shell as normal user (sts) instead of root
Made-with: Cursor
This commit is contained in:
@@ -1,6 +0,0 @@
|
|||||||
ui: redesign WiFi list with signal bars and cleaner layout
|
|
||||||
|
|
||||||
- Replace <select> with scrollable list of clickable items
|
|
||||||
- Show signal strength as 4-bar icon instead of percentage text
|
|
||||||
- Remove security info from parentheses, show lock icon only
|
|
||||||
- Smaller font size for compact mobile display
|
|
||||||
@@ -119,12 +119,15 @@ async function startTtyd() {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const shell = fs.existsSync('/bin/bash') ? '/bin/bash' : '/bin/sh';
|
const shell = fs.existsSync('/bin/bash') ? '/bin/bash' : '/bin/sh';
|
||||||
const proc = spawn(TTYD_BIN, ['-p', String(TTYD_PORT), '-i', '127.0.0.1', '-W', '-t', 'cursorBlink=true', shell], {
|
// 以普通用户身份启动 shell(与 SSH 登录一致)
|
||||||
|
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', loginCmd], {
|
||||||
stdio: 'ignore',
|
stdio: 'ignore',
|
||||||
detached: true,
|
detached: true,
|
||||||
});
|
});
|
||||||
proc.unref();
|
proc.unref();
|
||||||
log.info('ttyd', `已启动,端口 ${TTYD_PORT},shell=${shell}`);
|
log.info('ttyd', `已启动,端口 ${TTYD_PORT},用户=${ttydUser}`);
|
||||||
return true;
|
return true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log.warn('ttyd', '启动失败:', e.message);
|
log.warn('ttyd', '启动失败:', e.message);
|
||||||
|
|||||||
Reference in New Issue
Block a user