This commit is contained in:
even 2025-07-07 16:56:31 +08:00
commit 19e4bd819a

View File

@ -870,10 +870,15 @@ public class SftpUploadUtil {
channelSftp = (ChannelSftp) channel; channelSftp = (ChannelSftp) channel;
String chmodDir = remoteDir.substring(0, remoteDir.indexOf("default")); if (remoteDir.contains("default")){
log.info("分配权限路径,{}",chmodDir); String chmodDir = remoteDir.substring(0, remoteDir.indexOf("default"));
log.info("分配权限路径,{}",chmodDir);
sudoChmodORwx(session,chmodDir,password);
} else {
log.warn("路径中未找到 'default',跳过权限设置。当前路径: {}", remoteDir);
}
// 切换目录并列出内容用于调试 // 切换目录并列出内容用于调试
sudoChmodORwx(session,chmodDir,password);
// 切换到目标目录 // 切换到目标目录
channelSftp.cd(remoteDir); channelSftp.cd(remoteDir);