fix(file-manager): repair uploads and shared SFTP access
Build and publish Docker image / build-and-publish (push) Successful in 12s
Build and publish Docker image / build-and-publish (push) Successful in 12s
This commit is contained in:
1 parent
4c2f5f2c01
commit
2fcd0c3ef9
6 files changed
+275
-9
No files matched your search
@@ -338,6 +338,36 @@ def reconcile_sftp(server_id: str, user_id: str) -> bool:
|
||||
except Exception as e:
|
||||
logger.error(f"Error reconciling SFTP sidecar for {server_id}: {e}")
|
||||
|
||||
# Longhorn may mount a new website volume as root:root 0755. Keep the
|
||||
# SFTP chroot root-owned, but make only the shared data directory
|
||||
# writable by ftp-user. The setgid bit makes new entries inherit gid
|
||||
# 1000; existing files are deliberately left untouched.
|
||||
try:
|
||||
pods = k8s_manager.get_pods_for_server(namespace, server_id)
|
||||
if pods:
|
||||
permission_result = k8s_manager.exec_command(
|
||||
namespace,
|
||||
pods[0],
|
||||
[
|
||||
"sh",
|
||||
"-c",
|
||||
"chgrp 1000 /home/ftp-user/data && chmod 2775 /home/ftp-user/data "
|
||||
"&& echo sftp_data_permissions_ready",
|
||||
],
|
||||
container_name="sftp",
|
||||
)
|
||||
if "sftp_data_permissions_ready" not in str(permission_result):
|
||||
logger.warning(
|
||||
"Could not confirm SFTP data permissions for server %s",
|
||||
server_id,
|
||||
)
|
||||
except Exception as permission_error:
|
||||
logger.warning(
|
||||
"Could not set SFTP data permissions for server %s: %s",
|
||||
server_id,
|
||||
permission_error,
|
||||
)
|
||||
|
||||
# 3. Ensure port in Service
|
||||
try:
|
||||
service_name = f"{server_id}-service"
|
||||
|
||||
Reference in new issue
Block a user