ext4パーティションを正常にマウントできます。問題は、パーティション上のすべてのファイルがユーザーID 1000のユーザーによって所有されていることです。あるマシンではユーザーIDは1000ですが、別のマシンでは1010です。ユーザー名は両方のマシンで同じです。 、しかし、ファイルシステムにはユーザー名ではなくユーザーIDが保存されていることに気付きました。
次のような方法でファイルの所有権を修正できます:
find /mnt/example -exec chown -h 1010 {} ;
ただし、この外付けドライブを別のマシンにマウントする場合は、ファイルの所有権を再度修正して1000に戻す必要があります。
私が欲しいのはmount
を与えることです ユーザーIDを1000から1010にマップするというオプション。これにより、実際にファイルを変更する必要がなくなります。これを行う方法はありますか?
承認された回答:
bindfsパッケージを見てください。 bindfsは、既存のファイルシステムに加えて、ファイルのアクセス許可、ファイルの所有権などのさまざまな操作を可能にするFUSEファイルシステムです。
bindfsの–mapオプションを特に探しています:
--map=user1/user2:@group1/@group2:..., -o map=...
Given a mapping user1/user2, all files owned by user1 are shown as owned by user2. When user2 creates files, they are chowned to user1 in the underlying directory. When files are chowned to user2, they are chowned to user1 in the underlying directory. Works similarly for groups.
A single user or group may appear no more than once on the left and once on the right of a slash in the list of mappings. Currently, the options --force-user, --force-group, --mirror, --create-for-*, --chown-* and --chgrp-* override the corresponding behavior of this option.
Requires mounting as root.
したがって、/mnt/wrong
にユーザーID1001のファイルをマッピングするには /mnt/correct
へ ユーザーID1234で、次のコマンドを実行します:
sudo bindfs --map=1001/1234 /mnt/wrong /mnt/correct