我正在使用 Amazon Linux 并通过 Jenkins 作业运行脚本,包括这一行
touch /usr/java/jboss/standalone/deployments/myproject.war.dodeploy
这会导致错误......
touch: cannot touch ‘/usr/java/jboss/standalone/deployments/myproject.war.dodeploy’: Permission denied
我认为我已经正确设置了权限和组,因此我也在脚本中输出了它们。但我不明白为什么事情会崩溃。下面是输出。我还需要做什么才能让触摸命令正常工作?
+ whoami
jboss
+ groups jboss
jboss : jboss evotext
+ ls -al /usr/java/jboss/standalone/deployments/
total 20
drwxrwxr-x 4 deploy evotext 4096 Apr 23 18:18 .
drwxr-xr-x 8 jboss evotext 4096 Jun 24 2013 ..
drwxrwxr-x 11 jboss evotext 4096 Apr 23 18:23 myproject.war
drwxrwxr-x 9 deploy evotext 4096 Apr 22 19:21 jenkins.war
-rwxrwxr-x 1 deploy evotext 11 Apr 22 19:21 jenkins.war.deployed
+ touch /usr/java/jboss/standalone/deployments/myproject.war.dodeploy
touch: cannot touch ‘/usr/java/jboss/standalone/deployments/myproject.war.dodeploy’: Permission denied
Build step 'Execute shell' marked build as failure
答案1
也许父目录具有阻止您编辑它的 acl?尝试执行此命令:
sudo setfacl yourname:rwx /usr/java/jboss/standalone/deployments
其中 yourname 是您的用户名。