Montar NTFS Debian


Primeiramente gostaria de salientar que não sou o autor principal do conteúdo deste artigo. A minha intenção é de mostrar o que outros autores tem realizado (referenciando links para o conteúdo original) neste blog até como um guia pessoal para uso próprio e ainda compartilhar minhas anotações e pequenas modificações que realizo no conteúdo, desejando que possa ajudar mais alguém em algum lugar.
First and foremost, I take no credit for any of this post’s content. I am really just taking what others have done (which I have links to bellow) and am putting it on my blog for a personal reference and hopefully the small changes that I made to their guides will help someone somewhere.

link: https://wiki.debian.org/NTFS

link: https://manpages.debian.org/stretch/mount/mount.8.en.html

PARTUUID=19b262d8-718a-4eb8-95d8-89b169d71a14 /mnt/windows ntfs defaults,user,noauto,usermapping=/root/.NTFS-3G/UserMapping 0 0

Mount options for ntfs

usermapping=file-name
Use file file-name as the user mapping file instead of the default .NTFS-3G/UserMapping. If file-name defines a full path, the file must be located on a partition previously mounted. If it defines a relative path, it is interpreted relative to the root of NTFS partition being mounted.

User Mapping

NTFS uses specific ids to record the ownership of files instead of the uid and gid used by Linux. As a consequence a mapping between the ids has to be defined for ownerships to be recorded into NTFS and recognized.

By default, this mapping is fetched from the file .NTFS-3G/UserMapping located in the NTFS partition. The option usermapping= may be used to define another location. When the option permissions is set and no mapping file is found, a default mapping is used.

Each line in the user mapping file defines a mapping. It is organized in three fields separated by colons. The first field identifies a uid, the second field identifies a gid and the third one identifies the corresponding NTFS id, known as a SID. The uid and the gid are optional and defining both of them for the same SID is not recommended.

If no interoperation with Windows is needed, you can use the option permissions to define a standard mapping. Alternately, you may define your own mapping by setting a single default mapping with no uid and gid. In both cases, files created on Linux will appear to Windows as owned by a foreign user, and files created on Windows will appear to Linux as owned by root. Just copy the example below and replace the 9 and 10-digit numbers by any number not greater than 4294967295. The resulting behavior is the same as the one with the option permission set with no ownership option and no user mapping file available.

::S-1-5-21-3141592653-589793238-462643383-10000
If a strong interoperation with Windows is needed, the mapping has to be defined for each user and group known in both system, and the SIDs used by Windows has to be collected. This will lead to a user mapping file like :
john::S-1-5-21-3141592653-589793238-462643383-1008 mary::S-1-5-21-3141592653-589793238-462643383-1009 :smith:S-1-5-21-3141592653-589793238-462643383-513 ::S-1-5-21-3141592653-589793238-462643383-10000
The utility ntfs-3g.usermap may be used to create such a user mapping file.


Procure saber o login dos usuários linux da seguinte forma:
id $USER
cat /etc/group

use o comando abaixo para criar o mapeamento do usuário windows com o usuário linux
sudo ntfsusermap /dev/sda4

sudo cat UserMapping
sudo mkdir /root/.NTFS-3G/
sudo mv UserMapping /root/.NTFS-3G/



Comments