From b38b1d955bf7017f01e64c13ecc573ac93f58d76 Mon Sep 17 00:00:00 2001 From: Noratrieb <48135649+Noratrieb@users.noreply.github.com> Date: Sun, 25 Aug 2024 21:05:01 +0200 Subject: [PATCH] stduid --- bin/cluelesshd/src/main.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bin/cluelesshd/src/main.rs b/bin/cluelesshd/src/main.rs index af20135..88c544b 100644 --- a/bin/cluelesshd/src/main.rs +++ b/bin/cluelesshd/src/main.rs @@ -105,7 +105,10 @@ async fn handle_connection( let user = conn.inner().authenticated_user().unwrap().to_owned(); if *channel.kind() == ChannelKind::Session { tokio::spawn(async move { - let _ = handle_session_channel(user, channel).await; + let result = handle_session_channel(user, channel).await; + if let Err(err) = result { + error!(?err); + } }); } else { warn!("Trying to open non-session channel"); @@ -228,8 +231,12 @@ impl SessionState { // TODO: **user** home directory cmd.current_dir(user.home_dir()); cmd.env("USER", user.name()); + cmd.uid(user.uid()); + cmd.gid(user.primary_group_id()); + debug!(cmd = %shell.display(), uid = %user.uid(), gid = %user.primary_group_id(), "Executing process"); let mut shell = cmd.spawn()?; + let process_exit_send = self.process_exit_send.clone(); tokio::spawn(async move { let result = shell.wait().await;