使用 Putty 对 CentOS 7 中的文件夹权限进行故障排除

使用 Putty 对 CentOS 7 中的文件夹权限进行故障排除

我有一个用 bash 编写的部署脚本,它将基于 jvm 的应用程序部署到我们拥有的各种服务器上。部署文件在 Windows 机器上打包,然后使用 putty 的 scp 命令将 zip 文件暂存到服务器:

这是push.ps1脚本:

Remove-Item "C:\All\Scripts\Linux\JDA\deployments\dev-20160808\deploy\run\package.zip" -Force

Copy-Item -Path "C:\All\Scripts\Linux\JDA\deployments\dev-20160808\deploy\run\*" -Exclude @("debug.sh", "deploy.sh", "main.sh") -Destination "C:\All\Scripts\Linux\JDA\deployments\dev-20160808\deploy\package\scripts"
Compress-Archive -Path "C:\All\Scripts\Linux\JDA\deployments\dev-20160808\deploy\package" -DestinationPath "C:\All\Scripts\Linux\JDA\deployments\dev-20160808\package.zip" -Force
Move-Item -Path "C:\All\Scripts\Linux\JDA\deployments\dev-20160808\package.zip" -Destination "C:\All\Scripts\Linux\JDA\deployments\dev-20160808\deploy\run\package.zip" -Force
Compress-Archive -Path "C:\All\Scripts\Linux\JDA\deployments\dev-20160808\deploy\run" -DestinationPath "C:\All\Scripts\Linux\JDA\deployments\dev-20160808\deployment.zip" -Force

$pscpOutput = ""

pscp -pw shhhhh...secret! "C:\All\Scripts\Linux\JDA\deployments\dev-20160808\deployment.zip" [email protected]:/home/dev/deployment/ | Out-String | Tee-Object -Variable "pscpOutput" | Out-Null

Write-Verbose $pscpOutput

Remove-Item "C:\All\Scripts\Linux\JDA\deployments\dev-20160808\deployment.zip" -Force

# ./deploy.sh -p package.zip  -j /home/dev/x -r forward -d -t

当它运行时,我注意到我的终端中出现了 cp 错误:

| 20160810 21:08:41 UTC | 20160810 17:08:41 EDT | > Deployment: 375 -> Copying Deployment Package /templates for dev environment files...
| 20160810 21:08:41 UTC | 20160810 17:08:41 EDT | > Deployment: 376 -> cp -fr "/home/dev/deployment/package/templates/env/dev/." "/home/dev/x/jda/optimizer/runtimes/version/16.1.1/templates/env/dev/"
cp: cannot stat ‘/home/dev/deployment/package/templates/env/dev/.’: Permission denied

我检查了该目录并得到了以下我以前从未见过的输出。

为什么文字是红色的并且充满了???分数?

未知文件权限

答案1

我会检查路径中其他父目录的权限,以确保您具有读取和执行权限。当目录缺少执行特权时,我也看到过类似的问题。

相关内容