GNU/Linux >> Linux の 問題 >  >> Linux

ファイルシステムをマウントする方法、ユーザーIDのマッピング?

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

Linux
  1. LinuxでISOファイルをマウントするには?

  2. zip ファイルを読み取り専用ファイルシステムとしてマウントする

  3. 資格情報ファイルを mount.cifs に渡すにはどうすればよいですか?

  1. ファイルを作成してファイルシステムとしてマウントする方法は?

  2. Linux で iso ファイルをマウントする方法

  3. .fuse_hidden* ファイルを削除するには?

  1. Bashでファイルを1行ずつ読み取る方法

  2. Linux ファイルシステムを通常のユーザーとして読み取り/書き込み可能に手動でマウントするにはどうすればよいですか?

  3. 読み取り専用環境でファイルシステムをマウントするには?