Skip to content

Commit

Permalink
Fix login using authorized keys (#25)
Browse files Browse the repository at this point in the history
Fixed login using authorized keys by setting minimal permissions on the user's home directory.
  • Loading branch information
winromulus authored Jun 26, 2020
1 parent e2fad5f commit 9016cc2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ES.SFTP.Host/Security/UserManagementService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ private async Task SyncUsersAndGroups()

var homeDir = Directory.CreateDirectory(Path.Combine(HomeBasePath, user.Username));
await ProcessUtil.QuickRun("chown", $"root:root {homeDir.FullName}");
await ProcessUtil.QuickRun("chmod", $"700 {homeDir.FullName}");
await ProcessUtil.QuickRun("chmod", $"711 {homeDir.FullName}");

var sshDir = Directory.CreateDirectory(Path.Combine(homeDir.FullName, ".ssh"));
var sshKeysDir = Directory.CreateDirectory(Path.Combine(sshDir.FullName, "keys"));
Expand Down

0 comments on commit 9016cc2

Please sign in to comment.