Skip to content

Commit

Permalink
make user folders 700
Browse files Browse the repository at this point in the history
  • Loading branch information
lyang2821 committed Dec 18, 2024
1 parent 50e4c15 commit a88c3ed
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
12 changes: 5 additions & 7 deletions lapdev-dashboard/src/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -702,10 +702,10 @@ pub fn WorkspaceItem(
let workspace_hostname = workspace_hostname.clone();
move |ws_service| {
view! {
<div class="flex flex-col border-t items-center shadow-sm md:flex-row w-full">
<div class="lg:w-1/3 flex flex-row">
<div class="flex flex-col border-t items-center shadow-sm lg:flex-row w-full">
<div class="hidden w-1/3 lg:flex flex-row">
</div>
<div class="md:w-1/3 flex flex-col justify-center">
<div class="w-full lg:w-1/3 flex flex-col items-center lg:items-start">
<div class="flex flex-col p-4">
<span class="font-semibold">{ws_service.name.clone()}</span>
<div class="flex flex-row items-center text-sm text-gray-700 mt-2">
Expand All @@ -716,10 +716,8 @@ pub fn WorkspaceItem(
</div>
</div>
</div>
<div class="md:w-1/6 flex flex-row items-center p-4 justify-center">
</div>
<div class="md:w-1/6 flex flex-row items-center p-4 justify-center">
<div class="mr-10">
<div class="w-full lg:w-1/3 flex flex-row items-center p-4 justify-center xl:justify-end">
<div class="mx-11">
<OpenWorkspaceView workspace_name=ws_service.name.clone() workspace_status={workspace.status} workspace_folder=workspace_folder.clone() workspace_hostname=workspace_hostname.clone() align_right=true />
</div>
</div>
Expand Down
21 changes: 21 additions & 0 deletions lapdev-ws/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,12 @@ impl WorkspaceServer {
return Err(anyhow!("can't do useradd {username}").into());
}

let _ = Command::new("chmod")
.arg("700")
.arg(format!("/home/{username}"))
.output()
.await;

let _ = tokio::process::Command::new("usermod")
.arg("-a")
.arg("-G")
Expand Down Expand Up @@ -514,6 +520,11 @@ impl WorkspaceServer {
.arg(&workspace_base_folder)
.output()
.await?;
let _ = Command::new("chmod")
.arg("700")
.arg(&workspace_base_folder)
.output()
.await;

let prebuild_base_folder = self.osuser_prebuild_base_folder(username);
Command::new("mkdir")
Expand All @@ -522,6 +533,11 @@ impl WorkspaceServer {
.spawn()?
.wait()
.await?;
let _ = Command::new("chmod")
.arg("700")
.arg(&prebuild_base_folder)
.output()
.await;

let project_base_folder = self.osuser_project_base_folder(username);
Command::new("mkdir")
Expand All @@ -530,6 +546,11 @@ impl WorkspaceServer {
.spawn()?
.wait()
.await?;
let _ = Command::new("chmod")
.arg("700")
.arg(&project_base_folder)
.output()
.await;

let containers_config_folder = format!("/home/{username}/.config/containers");
Command::new("su")
Expand Down

0 comments on commit a88c3ed

Please sign in to comment.