2021年7月21日 星期三

sftp Received message too long

sftp 遇到 Received message too long 的錯誤表示 .bash_profile 或 .bashrc 等登入會執行的 Script 有產生 Output

/etc/ssh/sshd_config 預設是呼叫外部的 sftp-server
Subsystem sftp /usr/libexec/openssh/sftp-server

若環境希望保留執行的 Output,又希望 sftp 正常,把它改成 internal-sftp 就行了
Subsystem sftp internal-sftp

它就會使用程序內建的 sftp-server,不會呼叫外部的 sftp-server,也就不會執行 Shell 環境那些檔案

節錄 man sshd_config
Subsystem
Configures an external subsystem (e.g. file transfer daemon). Arguments should be a subsystem name and a command (with optional arguments) to execute upon subsystem request.

The command sftp-server implements the SFTP file transfer subsystem.

Alternately the name internal-sftp implements an in-process SFTP server. This may simplify configurations using ChrootDirectory to force a different filesystem root on clients.

By default no subsystems are defined.

沒有留言:

Certificate lifetime reduce to 47 days after 2029-03-15

在 2020年九月,憑證效期縮短為 398 天 爾後最新標準是 47 天,原因一樣是資安考量,分三個階段逐步調整 執行時間表 2026-03-15 縮短成 200 天 2027-03-15 縮短成 100 天 2029-03-15 縮短成 47 天 圖片來源 Sectigo r...