Skip to content

Commit

Permalink
z
Browse files Browse the repository at this point in the history
  • Loading branch information
shinohara-rin committed May 4, 2024
1 parent e2db402 commit a5fd8fd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
10 changes: 7 additions & 3 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31133,11 +31133,15 @@ function setup_sshkey(pubkey, qemu_process, ready_callback) {
let waitForKey = waitFor(pubkeyContent, () => {
ready_callback(qemu_process)
})
qemu_process.stdout.on('data', waitForKey)
qemu_process.stdin.write("echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config\n");
qemu_process.stdin.write("/etc/rc.d/sshd restart\n");
qemu_process.stdout.on('data', data => {
process.stdout.write(data.toString())
waitForKey(data)
})

qemu_process.stdin.write(`echo "${pubkeyContent}" > /root/.ssh/authorized_keys\n`);
qemu_process.stdin.write(`cat /root/.ssh/authorized_keys\n`);
qemu_process.stdin.write("echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config\n");
qemu_process.stdin.write("/etc/rc.d/sshd restart\n");
})
qemu_process.stdout.on('data', (data) => {
waitForPrompt(data)
Expand Down
10 changes: 7 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,15 @@ function setup_sshkey(pubkey, qemu_process, ready_callback) {
let waitForKey = waitFor(pubkeyContent, () => {
ready_callback(qemu_process)
})
qemu_process.stdout.on('data', waitForKey)
qemu_process.stdin.write("echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config\n");
qemu_process.stdin.write("/etc/rc.d/sshd restart\n");
qemu_process.stdout.on('data', data => {
process.stdout.write(data.toString())
waitForKey(data)
})

qemu_process.stdin.write(`echo "${pubkeyContent}" > /root/.ssh/authorized_keys\n`);
qemu_process.stdin.write(`cat /root/.ssh/authorized_keys\n`);
qemu_process.stdin.write("echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config\n");
qemu_process.stdin.write("/etc/rc.d/sshd restart\n");
})
qemu_process.stdout.on('data', (data) => {
waitForPrompt(data)
Expand Down

0 comments on commit a5fd8fd

Please sign in to comment.