mac和linux下软链接权限的不同

此文只当是一个mark吧

在mac和linux上软链接的使用基本是相同的,有一点不同的在权限方面:

1 linux的软链文件不能修改权限

详见man chmod :

chmod never changes the permissions of symbolic links; the chmod system call cannot change their permissions. This is not a problem since the permissions of symbolic links are never used. However, for each symbolic link listed on the command line, chmod changes the permissions of the pointed-to file. In contrast, chmod ignores symbolic links encountered during recursive directory traversals.

2 mac的软链文件可以用chmod设置权限  chmod -h 777 ./symlink

详见man chmod :

-h If the file is a symbolic link, change the mode of the link itself rather than the file that the link points to.

发表评论

电子邮件地址不会被公开。 必填项已用*标注