解决 MinIO 报错 RequestTimeTooSkewed 时间戳偏差过大修复
排查 MinIO 上传或读取对象抛出 403 Forbidden: RequestTimeTooSkewed 错误,同步客户端与服务端 NTP 时钟源。
问题现象
使用 AWS S3 SDK 或 MinIO 客户端向对象存储发起 API 调用时返回 403 拒绝错误:
<Error>
<Code>RequestTimeTooSkewed</Code>
<Message>The difference between the request time and the server's time is too large.</Message>
<RequestTime>20261115T120000Z</RequestTime>
<ServerTime>20261115T121800Z</ServerTime>
<MaxAllowedSkewMilliseconds>900000</MaxAllowedSkewMilliseconds>
</Error>
触发根因
AWS S3 签名认证协议(AWS Signature Version 4)强制要求:客户端请求头中包含的时间戳(x-amz-date)与服务端系统物理时钟之间的绝对时间差不得超过 15 分钟(900 秒),以此防范网络中间人重放攻击(Replay Attack)。当客户端机器或 MinIO 宿主机未启用时钟同步导致时间产生严重漂移时,请求会被服务端硬性拦截。
解决步骤
1. 检查并校准宿主机系统物理时钟
在 MinIO 服务端与客户端机器上执行时间对齐:
# 安装 chrony 时钟同步工具
sudo apt-get install chrony -y || sudo yum install chrony -y
# 立即强制同步时间源
sudo chronyd -q 'server pool.ntp.org iburst'
# 启动并保持后台同步服务
sudo systemctl enable --now chrony
2. 核对系统时区与当前 UTC 时间
运行命令验证当前系统时间:
timedatectl
确保 System clock synchronized: yes 且 NTP service: active。
验证确认
再次使用 MinIO Client 执行文件查看:
mc ls myminio/my-bucket
命令成功返回桶内对象列表,无任何时间偏差错误。


