diff options
| author | Chris Lu <chrislusf@users.noreply.github.com> | 2025-12-08 01:24:42 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-08 01:24:42 -0800 |
| commit | 982aae6d535a61d9af682ae902ea335b19204112 (patch) | |
| tree | f6103d3bd5868df30dc04f1f125e0545c7c06899 /weed/command/sftp.go | |
| parent | f5c0bcafa34639aaafb18e26d260bd6d02d639fb (diff) | |
| download | seaweedfs-982aae6d535a61d9af682ae902ea335b19204112.tar.xz seaweedfs-982aae6d535a61d9af682ae902ea335b19204112.zip | |
SFTP: support reloading user store on HUP signal (#7651)
Fixes #7650
This change enables the SFTP server to reload the user store configuration
(sftp_userstore.json) when a HUP signal is sent to the process, without
requiring a service restart.
Changes:
- Add Reload() method to FileStore to re-read users from disk
- Add Reload() method to SFTPService to handle reload requests
- Register reload hook with grace.OnReload() in sftp command
This allows administrators to add users or change access policies
dynamically by editing the user store file and sending a HUP signal
(e.g., 'systemctl reload seaweedfs' or 'kill -HUP <pid>').
Diffstat (limited to 'weed/command/sftp.go')
| -rw-r--r-- | weed/command/sftp.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/weed/command/sftp.go b/weed/command/sftp.go index ed93e44fe..f1a0d9e09 100644 --- a/weed/command/sftp.go +++ b/weed/command/sftp.go @@ -16,6 +16,7 @@ import ( "github.com/seaweedfs/seaweedfs/weed/sftpd" stats_collect "github.com/seaweedfs/seaweedfs/weed/stats" "github.com/seaweedfs/seaweedfs/weed/util" + "github.com/seaweedfs/seaweedfs/weed/util/grace" ) var ( @@ -148,6 +149,9 @@ func (sftpOpt *SftpOptions) startSftpServer() bool { UserStoreFile: *sftpOpt.userStoreFile, }) + // Register reload hook for HUP signal + grace.OnReload(service.Reload) + // Set up Unix socket if on non-Windows platforms if runtime.GOOS != "windows" { localSocket := *sftpOpt.localSocket |
