Samba network sharing NTFS drives and root permissions from local drives

29,387

Solution 1

Normally in these cases the permissions are set at mount time, since NTFS can't store unix permissions, to do so use something like this:

mount /dev/sdb1 /media/mydisk -o uid=youruser,gid=users

If you add these other two options to mount fmask=664,dmask=775, everyone in the users group will effectively be able to write to that file system. You can also use /etc/fstab if you want to mount the disk at boot time, the format is slightly different but the options are the same. Keep in mind that using NTFS in this specific case does have limitations compared to using EXT3/4, XFS, etc.

More info here man mount.ntfs-3g.

Solution 2

sudo apt-get install samba smbfs ntfs-3g ntfsprogs

smbfs: The SMB/CIFS protocol provides support for cross-platform file sharing with Microsoft Windows, OS X, and other Unix systems.

ntfs-3g: This package provides wrapper utilities for compatibility with the old "smbfs" filesystem type: smbmount, smbumount, and mount.smbfs.

NTFS-3G uses FUSE (Filesystem in Userspace) to provide support for the NTFS filesystem used by Microsoft Windows. It can:

  • create, remove, rename, or move files, directories, hard links, and streams;
  • read and write files, including streams, sparse files, and transparently compressed files;
  • handle special files like symbolic links, devices, and FIFOs;
  • provide standard management of file ownership and permissions, including POSIX ACLs.

This package also contains the tools previously available in the ntfsprogs package.

ntfsprogs: The Linux-NTFS project (http://www.linux-ntfs.org/) aims to bring full support for the NTFS filesystem to the Linux operating system.

This is a set of tools targeted for people interested in working with the NTFS support in the Linux kernel and using it. The following utilities are included:

  • ntfsfix - Fix common filesystem errors and force Windows to check NTFS.
  • mkntfs - Format a partition with an NTFS filesystem, optionally bootable.
  • ntfsinfo - Show some information about an NTFS partition or one of the files or directories within it.
  • ntfslabel - Show, or set, an NTFS partition's volume label.
  • ntfsresize - Resize an NTFS partition without losing data.
  • ntfsundelete - Recover deleted files from an NTFS partition.
  • ntfscluster - Locate the owner of any given sector or cluster on an NTFS partition.
  • ntfscat - Concatenate files and print them on the standard output (without mounting the partition).
  • ntfsls - List directory contents on an NTFS filesystem (without mounting).
  • ntfscp - Overwrite files on an NTFS partition.
  • ntfsclone - Efficiently clone an NTFS filesystem or a part of it.
  • ntfsmount - Mount an NTFS partition from user-space using libntfs and FUSE.
  • ntfsdecrypt - Decrypt NTFS-encrypted files (NOT INCLUDED).
  • ntfscmp - Compare two NTFS volumes and tell the differences.

/etc/fstab:

/dev/sdb1 /mnt/share ntfs-3g defaults,users,locale=en_US.UTF-8 0 0
  • /dev/sdb1 = ntfs drive
  • /mnt/share = mount point
Share:
29,387

Related videos on Youtube

Bruno Pereira
Author by

Bruno Pereira

Father of happy young brat. Loves Belgium beers, good cognacs and perfect espressos. Loves cooking for friends, a good conversation or a book. Is interested in everything tech, specially open source and has a extensive computer background. Can be contacted by mail, facebook, linkedin and when I am not lazy I can trow a thought or two in twitter @bpereira81.

Updated on September 18, 2022

Comments

  • Bruno Pereira
    Bruno Pereira over 1 year

    I'm able to share my internal 2ndry NTFS drives (sdb1,2 and 3) on the network with Windows computers now but even though Samba read/write is enabled, Windows network computers can only open files "read-only" and can't save files to the samba shared drives/folders.

    I try to set permissions in Ubuntu via folder and/or file properties even logged in root via Nautilus but all the samba shared folders and files are set as owner = root, accessible and does not allow me to change them to read/write, it just resets to root, accessible, in other words, I can't change permissions.

    I'm running Ubuntu 11.04 Gnome on an old Dell Dimension 2400.

    Also, in order to for me to copy or move any files from the Ubuntu drive to the sdb1,2 or 3 drives, I have to gksu nautilus. This consequently prevents me from copying .ISO files to my "Multisys" thumb drive too.

    • Anny Igi
      Anny Igi about 12 years
      what about using chown?
  • Gabriel Fair
    Gabriel Fair about 5 years
    Since this answer was posted, ntfs-3g has assumed the ntfsprogs code and is still maintained: tuxera.com/community/open-source-ntfs-3g