Conversation
- ISftpService 加 SetOwnerAsync / GetOwnerChoicesAsync,ISftpClientWrapper 加 ChangeOwnerAsync。 - SFTP:名称经会话缓存的 passwd / group 查表翻成数字 id(先当名称、再当数字,与 chown 命令一致), 翻不出来当场报错、不发请求;只改一项时先 stat 取回另一项再一并 setstat,服务端没报 uid/gid 就不写。 - FTP 与插件协议:候选返回 null(弹窗里两行只读),SetOwnerAsync 抛 NotSupportedException。 - 属性弹窗:属主 / 属组换成可编辑下拉,确定后先 chown 再 chmod;MessageDialog 补 ComboBox 样式。 - 五份 resx 补 4 个键。 - 测试:SftpServiceTests、FileBrowserViewModelTests、SerializedSftpServiceTests, 新增对真实 OpenSSH 的 SftpOwnerIntegrationTests。
joesdu
added a commit
to VelaShellLabs/velashell-docs
that referenced
this pull request
Sep 30, 2026
docs(host): 远端文件改属主 / 属组(chown)(joesdu/VelaShell#539)
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
主要改动
feature-plan.md🟢 P3 项「远端文件 chown / 属主编辑」。原先属性弹窗里属主、属组只读,ISftpService只有 chmod。ISftpService加SetOwnerAsync(sessionId, path, owner, group)(名称或十进制数字 id,null = 这一项不改)与GetOwnerChoicesAsync(候选用户名 / 组名;null = 后端改不了属主);ISftpClientWrapper加ChangeOwnerAsync(path, uid?, gid?)。RemoteIdentityResolver,每会话一次getent passwd/group),多记一份名称 → id,同 id 的别名(BSD 的toor)也认。顺序与chown命令一致:先当名称、再当数字。翻不出来抛本地化的错误,不发请求;纯 SFTP 账号查不到表时只能填数字。VelaSftpClientWrapper:SFTP v3 的 uid 与 gid 共用一个标志位,只改一项时先 stat 取回另一项再一并 setstat;服务端 stat 没报 uid/gid 就不写(拿不到的一项会被当成 0,等于把文件交给 root)。只用库的公开SetAttributesAsync,src/VelaShell.Ssh没动。SetOwnerAsync抛NotSupportedException。路由与串行化装饰器透传。MessageDialog的 BodyHost 补 ComboBox 样式,全用令牌),清空即不改。确定后先 chown 再 chmod:属主最容易被拒,被拒时什么都还没改;chown 成了、chmod 被拒时照样刷新列表,错误条不被刷新清掉。Sftp_OwnerPlaceholder、Sftp_GroupPlaceholder、SftpSvc_UnknownUser、SftpSvc_UnknownGroup)。测试
SftpServiceTests新增 9 条:名称翻译、只改属组、无查表时的数字 id、名字像数字时名字优先、别名、未知名称不发请求(且消息不带(Parameter …)尾巴)、空操作、候选排序、无查表时给空名单而非 null。FileBrowserViewModelTests新增 5 条(候选透传、候选取不到退回只读、先 chown 再 chmod、chown 被拒不动权限、chmod 被拒仍刷新且保留错误),原有 3 条改用新委托;SerializedSftpServiceTests透传清单补两项。SftpOwnerIntegrationTests(DockerIntegration)对真实 OpenSSH:只改属组时属主原样写回;把属主交给 root 冒出VelaSftpPermissionDeniedException且文件不动。把「沿用当前值」临时改成写 0 后该用例报 Permission denied 失败 —— 确认它真跑过,不是早退记为通过。编译 0 警告。
dotnet test VelaShell.slnx:VelaShell.Core.Tests616 通过 / 10 跳过 / 1 失败,VelaShell.Tests1626 通过 / 8 跳过,VelaShell.Infrastructure.Tests569 通过 / 4 跳过,其余全过。唯一的失败X11_RefusedByServer_KeepsAgentForwardingAndWarnsOnce与本 PR 无关:本机velashell-test-shells镜像建于 09-22,早于 Dockerfile 里给vela-dash关 X11 的Match段(09-23),重建镜像即可。文档
涉及文档修改。
plan.md§144;feature-plan.md删掉路线图里的 chown 一行,「三、文档待同步」登记一行。zh/host/SFTP双栏与WinSCP差距分析.md、zh/host/交互与界面规格.md及英文镜像en/host/sftp-dual-pane-winscp-gap-analysis.md、en/host/interaction-and-ui-specs.md。文档同步见 VelaShellLabs/velashell-docs#78,与本 PR 一起合。