Skip to content

Commit

Permalink
Fix chown to not dereference symlink
Browse files Browse the repository at this point in the history
  • Loading branch information
nbdd0121 committed Mar 19, 2024
1 parent e8fa517 commit 66eb6c8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/docker/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ impl Container {
}

pub async fn chown_to_user(&self, path: &str) -> Result<()> {
self.exec_as_root(&["chown", &format!("{}:", self.user), path])
// Use `-h` to not follow symlink, and `user:` will use user's login group.
self.exec_as_root(&["chown", "-h", &format!("{}:", self.user), path])
.await?
.collect()
.await?;
Expand Down

0 comments on commit 66eb6c8

Please sign in to comment.