chmod 777 -R on existing path getting chmod: -R: No such file or directory

社会主义新天地 提交于 2019-12-08 09:31:31

问题


I wanted to grant operation access using sudo chmod 777 -R <path> on mac, I double checked the given path, and it's existing and no typos, but I still got chmod: -R: No such file or directory. Any ideas about why I'm getting this error?


回答1:


If you look at the synopsis from the man page for chmod you will se the following:

SYNOPSIS
chmod [OPTION]... MODE[,MODE]... FILE...
chmod [OPTION]... OCTAL-MODE FILE...
chmod [OPTION]... --reference=RFILE FILE...

The -R flag should be used before the actual file mode, so you need to call the command like this:

sudo chmod -R 777 <path>

Right now you are trying to set 777 permission on a file named -R which of course does not exist.



来源:https://stackoverflow.com/questions/39043429/chmod-777-r-on-existing-path-getting-chmod-r-no-such-file-or-directory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!