Answers:
使用-p
标志。
-p same as --preserve=mode,ownership,timestamps
--preserve[=ATTR_LIST]
preserve the specified attributes (default: mode,ownership,timestamps), if possible additional attributes: context, links, xattr, all
请注意,要正确复制权限,目标文件系统应与源文件系统相同。换句话说,应该将外部驱动器格式化ext4
,就像通常情况下一样,将主文件夹存储在该类型的分区上。
使用sudo cp -a /home/my_home /media/backup/my_home
,它将递归到子目录并保留所有文件属性。