Skip to content

Commit ccb578e

Browse files
skulidropekclaude
andcommitted
feat(ssh): embed password in sshCommand via sshpass
- buildSshCommand: when no key → sshpass -p <sshUser> ssh ... - sshUser is also the default password (set via chpasswd at build time) - Result: one command from clone/create output connects immediately - Key auth path unchanged (ssh -i <key> ...) - INVARIANT: sshCommand from REST API is always directly executable Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent a7d99b6 commit ccb578e

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

packages/lib/src/usecases/projects-core.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,16 @@ const sshOptions = "-tt -Y -o LogLevel=ERROR -o StrictHostKeyChecking=no -o User
1818

1919
export type ProjectLoadError = PlatformError | ConfigNotFoundError | ConfigDecodeError
2020

21+
// CHANGE: use sshpass when no key provided so the command works without interaction
22+
// WHY: password = sshUser (set via chpasswd at build time); sshpass embeds it in one command
23+
// PURITY: CORE
24+
// INVARIANT: sshKey !== null → key auth; sshKey === null → sshpass with default password
2125
export const buildSshCommand = (
2226
config: TemplateConfig,
2327
sshKey: string | null
2428
): string =>
2529
sshKey === null
26-
? `ssh ${sshOptions} -p ${config.sshPort} ${config.sshUser}@localhost`
30+
? `sshpass -p ${config.sshUser} ssh ${sshOptions} -p ${config.sshPort} ${config.sshUser}@localhost`
2731
: `ssh -i ${sshKey} ${sshOptions} -p ${config.sshPort} ${config.sshUser}@localhost`
2832

2933
export type ProjectSummary = {

0 commit comments

Comments
 (0)