mac osx系统 我在一个目录下执行了下面的操作
cp -R backend/ api
ls -al
drwxr-xr-x@ 9 root admin 306 7 15 09:46 api
drwxr-xr-x@ 10 xinyue admin 340 7 15 10:40 backend
复制之后发现 他是属于root的,如何让复制后也和上面的backend一样属于xinyue
mac osx系统 我在一个目录下执行了下面的操作
cp -R backend/ api
ls -al
drwxr-xr-x@ 9 root admin 306 7 15 09:46 api
drwxr-xr-x@ 10 xinyue admin 340 7 15 10:40 backend
复制之后发现 他是属于root的,如何让复制后也和上面的backend一样属于xinyue
cp -Rp backend/ api
# man cp
-p Cause cp to preserve the following attributes of each source file in the copy: modification time, access time, file flags, file mode, user ID, and group ID, as allowed by
permissions. Access Control Lists (ACLs) and Extended Attributes (EAs), including resource forks, will also be preserved.
3 回答3.9k 阅读✓ 已解决
2 回答1.5k 阅读✓ 已解决
2 回答1.3k 阅读✓ 已解决
2 回答1.5k 阅读
1 回答1.3k 阅读
1.1k 阅读
807 阅读
不需要切换用户,sudo就可以。