on main help sign in
fix: removed the hardcode codex and claude form ssh.sh
commit518ca14fd3cbc03857f493edac874e624acdf971 authorrobcholz <84130577+robcholz@users.noreply.github.com> dateSat 7 Feb 2026, 17:12 (8 months ago) parentc0c52a5
5 files changed+48−20
src/config.rs+2−2 src/explain.rs+34−6 src/instance.rs+10−1 src/ssh.sh−9 vibebox.toml+2−2
src/config.rs+2−2
@@ -81,11 +81,11 @@ fn default_mounts() -> Vec<String> {
8181 let mut mounts = Vec::new();
8282 let codex_host = home.join(".codex");
8383 if codex_host.exists() {
84− mounts.push("~/.codex:/usr/local/codex:read-write".to_string());
84+ mounts.push("~/.codex:/home/vibecoder/.codex:read-write".to_string());
8585 }
8686 let claude_host = home.join(".claude");
8787 if claude_host.exists() {
88− mounts.push("~/.claude:/usr/local/claude:read-write".to_string());
88+ mounts.push("~/.claude:/home/vibecoder/.claude:read-write".to_string());
8989 }
9090 mounts
9191}
src/explain.rs+34−6
@@ -12,8 +12,9 @@ pub fn build_mount_rows(
1212) -> Result<Vec<tui::MountListRow>, Box<dyn Error + Send + Sync>> {
1313 let mut rows = Vec::new();
1414 rows.extend(default_mounts(cwd)?);
15+ let guest_home = resolve_guest_home(cwd)?;
1516 for spec in &config.box_cfg.mounts {
16− rows.push(parse_mount_spec(cwd, spec, false)?);
17+ rows.push(parse_mount_spec(cwd, spec, false, &guest_home)?);
1718 }
1819 Ok(rows)
1920}
@@ -75,6 +76,7 @@ fn parse_mount_spec(
7576 cwd: &Path,
7677 spec: &str,
7778 default_mount: bool,
79+ guest_home: &str,
7880) -> Result<tui::MountListRow, Box<dyn Error + Send + Sync>> {
7981 let parts: Vec<&str> = spec.split(':').collect();
8082 if parts.len() < 2 || parts.len() > 3 {
@@ -99,11 +101,7 @@ fn parse_mount_spec(
99101 };
100102
101103 let host_display = display_host_spec(cwd, host_part);
102− let guest_display = if Path::new(guest_part).is_absolute() {
103− guest_part.to_string()
104− } else {
105− format!("/root/{guest_part}")
106− };
104+ let guest_display = resolve_guest_display(guest_part, guest_home);
107105 Ok(tui::MountListRow {
108106 host: host_display,
109107 guest: guest_display,
@@ -128,6 +126,36 @@ fn display_host_spec(cwd: &Path, host: &str) -> String {
128126 }
129127}
130128
129+fn resolve_guest_home(cwd: &Path) -> Result<String, Box<dyn Error + Send + Sync>> {
130+ let instance_dir = cwd.join(session_manager::INSTANCE_DIR_NAME);
131+ if let Ok(Some(user)) = instance::read_instance_ssh_user(&instance_dir) {
132+ return Ok(format!("/home/{user}"));
133+ }
134+ Ok(format!("/home/{}", instance::DEFAULT_SSH_USER))
135+}
136+
137+fn resolve_guest_display(guest: &str, guest_home: &str) -> String {
138+ if guest == "~" {
139+ return "~".to_string();
140+ }
141+ if let Some(stripped) = guest.strip_prefix("~/") {
142+ return format!("~/{stripped}");
143+ }
144+ if Path::new(guest).is_absolute() {
145+ if let Ok(stripped) = Path::new(guest).strip_prefix(guest_home) {
146+ if stripped.components().next().is_none() {
147+ "~".to_string()
148+ } else {
149+ format!("~/{}", stripped.display())
150+ }
151+ } else {
152+ guest.to_string()
153+ }
154+ } else {
155+ format!("/root/{guest}")
156+ }
157+}
158+
131159fn display_path(path: &Path) -> String {
132160 let Ok(home) = env::var("HOME") else {
133161 return path.display().to_string();
src/instance.rs+10−1
@@ -27,7 +27,7 @@ use crate::{
2727
2828const SSH_KEY_NAME: &str = "ssh_key";
2929pub(crate) const SERIAL_LOG_NAME: &str = "serial.log";
30−const DEFAULT_SSH_USER: &str = "vibecoder";
30+pub(crate) const DEFAULT_SSH_USER: &str = "vibecoder";
3131const SSH_CONNECT_RETRIES: usize = 30;
3232const SSH_CONNECT_DELAY_MS: u64 = 500;
3333const SSH_SETUP_SCRIPT: &str = include_str!("ssh.sh");
@@ -181,6 +181,15 @@ pub fn read_instance_vm_ip(
181181 Ok(config.and_then(|cfg| cfg.vm_ipv4))
182182}
183183
184+pub fn read_instance_ssh_user(
185+ instance_dir: &Path,
186+) -> Result<Option<String>, Box<dyn std::error::Error>> {
187+ let config = read_instance_config(instance_dir)?;
188+ Ok(config
189+ .map(|cfg| cfg.ssh_user)
190+ .filter(|user| !user.trim().is_empty()))
191+}
192+
184193pub fn touch_last_active(instance_dir: &Path) -> Result<(), Box<dyn std::error::Error>> {
185194 let mut config = load_or_create_instance_config(instance_dir)?;
186195 let now = OffsetDateTime::now_utc().format(&Rfc3339)?;
src/ssh.sh−9
@@ -63,19 +63,10 @@ fi
6363install -d -m 700 -o "$SSH_USER" -g "$SSH_USER" "/home/${SSH_USER}/.ssh"
6464install -m 600 -o "$SSH_USER" -g "$SSH_USER" "$KEY_PATH" "/home/${SSH_USER}/.ssh/authorized_keys"
6565
66−# Ensure codex/claude are visible in the user's HOME
6766USER_HOME="$(getent passwd "$SSH_USER" | cut -d: -f6 2>/dev/null || true)"
6867if [ -z "$USER_HOME" ]; then
6968 USER_HOME="/home/${SSH_USER}"
7069fi
71−install -d -m 755 /usr/local/codex /usr/local/claude
72−if [ ! -e "${USER_HOME}/.codex" ]; then
73− ln -s /usr/local/codex "${USER_HOME}/.codex"
74−fi
75−if [ ! -e "${USER_HOME}/.claude" ]; then
76− ln -s /usr/local/claude "${USER_HOME}/.claude"
77−fi
78−chown -h "${SSH_USER}:${SSH_USER}" "${USER_HOME}/.codex" "${USER_HOME}/.claude" 2>/dev/null || true
7970
8071# Vibebox shell commands
8172install -d -m 755 /etc/profile.d
vibebox.toml+2−2
@@ -2,8 +2,8 @@
22cpu_count = 2
33ram_mb = 2048
44mounts = [
5− "~/.codex:/usr/local/codex:read-write",
6− "~/.claude:/usr/local/claude:read-write",
5+ "~/.codex:~/.codex:read-write",
6+ "~/.claude:~/.claude:read-write",
77]
88
99[supervisor]