Skip to content

Commit

Permalink
feat(lib): 创建家目录时设置权限为740 (#953)
Browse files Browse the repository at this point in the history
改动:
insertKeyAsRoot时会创建家目录,之前的权限默认为755, 不希望其他用户可以读以及访问该家目录,故创建家目录时设定权限为740

结果:
新用户创建后家目录如下

![image](https://github.com/PKUHPC/SCOW/assets/130351655/526e6d2b-dd0d-49b2-bbab-461b0c5105b6)
  • Loading branch information
ZihanChen821 authored Nov 8, 2023
1 parent e50c921 commit f42488e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/early-llamas-retire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@scow/lib-ssh": patch
---

创建家目录时默认权限为 740
1 change: 1 addition & 0 deletions libs/ssh/src/key.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export async function insertKeyAsRoot(

// make sure user home directory exists.
await ssh.mkdir(userHomeDir, undefined, sftp);
await sftpChmod(sftp)(userHomeDir, "740");
// root create the directory, so we need to change the owner
await sftpChown(sftp)(userHomeDir, uid, gid);

Expand Down

0 comments on commit f42488e

Please sign in to comment.