大网数据广告活动
服务器运维问答

Why would chmod give "No such file or directory" when running recursively?

· 52CE 我爱测

I can change the permissions of the file directly: # chmod --changes --recursive ug+rwX /var/www/shared/tmp/cache/assets/BA0/280/sprockets%2F286302903364106648b609d708884f78 and I can also change the permissions of the directory …

问题原文

原帖链接 · Pablo Fernandez · CC BY-SA 3.0

I can change the permissions of the file directly:

# chmod --changes --recursive ug+rwX       /var/www/shared/tmp/cache/assets/BA0/280/sprockets%2F286302903364106648b609d708884f78

and I can also change the permissions of the directory that contains the file:

# chmod --changes --recursive ug+rwX       /var/www/shared/tmp/cache/assets/BA0/280

when I try to change the permission of the directory that contains that directory, recursively, I get an error about the previous directory not being found:

# chmod --changes --recursive ug+rwX       /var/www/shared/tmp/cache/assets/BA0
chmod: getting new attributes of `280': No such file or directory

The current permissions, even though I don't how this can be of any influence, look like this:

# ls -alR /var/www/shared/tmp/cache/assets/BA0
/var/www/shared/tmp/cache/assets/BA0:
total 20
drwxrwsr-x   3 rails rails  4096 Jun  4 09:54 .
drwxrwsr-x 569 rails rails 12288 Jun  4 09:54 ..
drwxrwsr-x   2 rails rails  4096 Jun  4 09:54 280

/var/www/shared/tmp/cache/assets/BA0/280:
total 12
drwxrwsr-x 2 rails rails 4096 Jun  4 09:54 .
drwxrwsr-x 3 rails rails 4096 Jun  4 09:54 ..
-rw-rw-r-- 1 rails rails  481 Jun  4 09:54 sprockets%2F286302903364106648b609d708884f78

I'm running the commands as root. Any ides?

已采纳解答

原帖链接 · LatinSuD · CC BY-SA 4.0

This bug looks related:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=706097

I can reproduce it in Debian 7 with Coreutils 8.13-3.5.

I think that not using --changes or --verbose can workaround the problem.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2014-06-04)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0 / CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。