2

When I ssh into my computer, files I create on the main hard drive are owned by me:

$ touch test
$ ls -l test
-rw-r--r-- 1 smithty domain users 0 Aug 16 17:26 test

But when I move into a folder that's on a second hard drive, everything I create is owned by root as default:

$ cd data
$ touch test
$ ls -l test
-rwxrwxrwx 1 root root 0 Aug 16 17:28 test

I assume this is because I'm doing something wrong when I mount this drive, but I'm not sure what. I use the following config in /etc/fstab:

UUID=A88667B486678224 /media/data ntfs rw,nosuid,dev,exec,auto,nouser,async 0 2

I originally used the defaults option, but thought that shifting to nosuid would fix this. It hasn't though. Have I done something wrong in my fstab, or is there something else amiss.

This is on Ubuntu 14.04.1. My login shell is dash, but the problem is the same if I switch to bash.

1 Answer 1

5

NTFS doesn't know what a Linux user id is. It doesn't store such metadata. So everything gets to be root.

ext4/xfs (which is what your main hard drive likely is) does know it.

You might want to mount using the "uid=xxx option, see man page"

3
  • 1
    That makes sense, thanks. I was worried I'd somehow managed to silently turn on sudo for the whole drive!
    – Tyler
    Commented Aug 16, 2017 at 21:47
  • If you need to interoperate with Windows, NTFS-3G can be set up to understand user IDs.
    – Mark
    Commented Aug 16, 2017 at 22:37
  • Thanks @Mark . I don't actually have to interoperate with Windows with this machine. Our IT department is new to Linux, and it looks like they formatted the second hard drive from a Windows computer. If I hadn't already put 400G of data on it I'd reformat it to ext4
    – Tyler
    Commented Aug 17, 2017 at 13:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .