我正在考虑将我的Linux主分区合并到c:\ Users中,因此在Windows中启动时,我的所有文件都在c:\ Users \ trusktr中,而当我启动Linux时,我将c:\ Users挂载了/ home,以便我可以访问/ home / trusktr中的文件。我试图使在两个操作系统之间共享文件(包括点文件等)变得容易,以便于vim和bash之类的行为在整个操作系统之间表现完全相同。
我想我只是将所有内容从linux / home复制到c:\ users,这将导致所有内容默认情况下具有777权限(我不介意,我是唯一的用户,因此没有安全问题)。这样行吗?
然后我发现了ntfg-3g.usermap。这似乎使我可以chmod 655 /some/file
在linux中执行类似操作,并且可以正常工作。我很好奇,一旦我将linux用户映射到Windows用户,它是否还会保留我的所有文件权限。
所以,我的主要麻烦是我正在运行ntfs-3g.usermap,直到它要求我提供一个与文件关联的组ID都很好,但是我不知道所以我按Enter,然后它似乎走了错误。
这是输出的样子。前几行User :
和Group :
提示为空,因为我按Enter键。然后我输入了1002作为User :
提示,然后出现问题,我不知道如何处理。
This tool will help you to build a mapping of Windows users
to Linux users.
Be prepared to give Linux user id (uid) and group id (gid)
for owners of files which will be selected.
"/dev/sda4" opened
* Scanning "/dev/sda4" (two levels)
* Search for "Documents and Settings" and "Users"
Under Windows login "admin"
file "AppData" has no mapped group
By which Linux login should this file be owned ?
Enter gid of login, or just press "enter" if this file
does not belong to a user, or you do not known to whom
Group :
Under Windows login "admin"
file "Contacts" has no mapped owner
By which Linux login should this file be owned ?
Enter uid of login, or just press "enter" if this file
does not belong to a user, or you do not known to whom
User :
Under Windows login "Administrator"
file "AppData" has no mapped group
By which Linux login should this file be owned ?
Enter gid of login, or just press "enter" if this file
does not belong to a user, or you do not known to whom
Group :
Under Windows login "Public"
file "AppData" has no mapped group
By which Linux login should this file be owned ?
Enter gid of login, or just press "enter" if this file
does not belong to a user, or you do not known to whom
Group :
Under Windows login "trusktr"
file "Desktop" has no mapped owner
By which Linux login should this file be owned ?
Enter uid of login, or just press "enter" if this file
does not belong to a user, or you do not known to whom
User : 1002
* Search for other directories /
file "CORE.xml" has no mapped group
By which Linux login should this file be owned ?
Enter gid of login, or just press "enter" if this file
does not belong to a user, or you do not known to whom
Group :
"/dev/sda4" closed
You have defined no group, this can cause problems
Do you accept defining a standard group ?
y
* Creating file UserMapping
# Generated by usermap for Linux, v 1.1.4
:1002:S-1-5-21-1991058912-2816109820-761292756-513
1002:1002:S-1-5-21-2516108075-519671461-2442963378-1001
Undecided :
S-1-5-21-2516108075-519671461-2442963378-513
S-1-5-21-2516108075-519671461-2442963378-1002
* You will have to move the file "UserMapping"
to directory ".NTFS-3G" after mounting
因此,在ntfs-3g.usermap命令完成后生成的内容是:
# Generated by usermap for Linux, v 1.1.4
:1002:S-1-5-21-1991058912-2816109820-761292756-513
1002:1002:S-1-5-21-2516108075-519671461-2442963378-1001
知道我该怎么办吗?
几分钟后编辑:
当我在Linux上安装NTFS Windows分区时,在设置UserMappings文件后,ls -l /mnt/windows-partition/Users/trusktr/
显示文件的所有权为1002:1002。通常,当我在linux中并检查时,它们应该是1002:100 ls -l /home/trusktr/
。因此,我打开了UserMappings文件,发现其中包含1002:1002
其他内容,因此将其更改为1002:100
现在,当我在NTFS分区上列出文件时,它们显示的所有权与我在Linux中的所有权相匹配。
因此,这是编辑后的UserMappings文件现在的样子(更改位于第二行的开头):
# Generated by usermap for Linux, v 1.1.4
:1002:S-1-5-21-1991058912-2816109820-761292756-513
1002:100:S-1-5-21-2516108075-519671461-2442963378-1001
我仍然不确定UserMappings文件中的第一行是什么。我的猜测是,它与拥有c:\ Windows \ CORE.xml文件的组有关。
因此,希望这可行!现在,我将使用rsync将来自/ home / trusktr的所有文件合并到c:\ Users \ trusktr(以及其他从/ home到c:\ Users的用户文件夹)中,然后尝试将c:\ Users挂载为我的/ home Linux的...
编辑,7小时后:
我做到了!我已成功在Windows和Linux之间共享主文件夹。我可以启动到任何一个操作系统,并且在桌面上具有相同的文件。现在,我要测试一段时间,看看它是否稳定。我将发布我所做的更新...
编辑,七个月后:
在完成用户映射并将其放置在Windows分区的/.NTFS-3G文件夹中之后,可以正常启动Windows。对于Linux,/ Users文件夹现在应该是我的主目录。可以在fstab中设置。基本上,告诉它安装Windows分区,然后告诉它将Users文件夹安装为/ home。例如:
# <file system> <dir> <type> <options> <dump> <pass>
# mount the windows partition somewhere.
/dev/NTFS-part /mnt/windows ntfs-3g defaults 0 0
# then bindount the Users folder as /home.
/mnt/windows/Users /home none bind 0 0
编辑,24个月后:
我现在正在执行与上述类似的步骤,但是使用ntfs-3g在两者之间使用NTFS在Linux和OS X上进行双重引导。现在,下一步是像上面一样将Windows添加到组合中,并在所有三个OS之间具有三启动共享主文件夹。:}
ls -l
某些目录中的速度较慢。是的,我一定会更新所有详细信息。我也在考虑在archlinux.org上建立一个Wiki页面。