Skip to content
This repository was archived by the owner on Jan 12, 2025. It is now read-only.

Commit da8d1c4

Browse files
committed
ssh: support virtme.ssh
Provide an option to start sshd in the guest. The sshd init script will be provided as a guest script by virtme-ng (if not present `virtme.ssh` will be simply ignored). Signed-off-by: Andrea Righi <arighi@nvidia.com>
1 parent fe8484d commit da8d1c4

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/main.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -988,6 +988,16 @@ fn setup_user_session() {
988988
run_user_session(consdev.as_str(), uid);
989989
}
990990

991+
fn run_sshd() {
992+
if let Ok(cmdline) = std::fs::read_to_string("/proc/cmdline") {
993+
if cmdline.contains("virtme.ssh") {
994+
if let Some(guest_tools_dir) = get_guest_tools_dir() {
995+
utils::run_cmd(format!("{}/virtme-sshd-script", guest_tools_dir), &[]);
996+
}
997+
}
998+
}
999+
}
1000+
9911001
fn run_snapd() {
9921002
if let Ok(cmdline) = std::fs::read_to_string("/proc/cmdline") {
9931003
if cmdline.contains("virtme.snapd") {
@@ -1064,6 +1074,7 @@ fn run_misc_services() -> thread::JoinHandle<()> {
10641074
mount_virtme_initmounts();
10651075
fix_packaging_files();
10661076
override_system_files();
1077+
run_sshd();
10671078
run_snapd();
10681079
})
10691080
}

0 commit comments

Comments
 (0)