0

I'm using the Ubuntu bash on Windows 10(v1804) and am experiencing a problem with the chown command. I'm trying to change the ownership of a file I created on my desktop with the following path:

mnt/c/users/XY/Desktop/filecat.txt

Using sudo -i I switch to the root user and navigate to the mentioned path and run

chown -v user1 filecat.txt

after which I get this message confirming the ownership change:

changed ownership of 'filecat.txt' from amar to user1

However, when I run ls -l filecat.txt it does not show any change in user. It's still the same user which created the file.

Anyone have any idea what might be the problem? I've been searching online but finding nothing similar so here I am asking the question myself.

EDIT:

This is the full output of the command line mentioned in the comments.

$ ls -l filecat.txt; chown user1 filecat.txt; ls -l filecat.txt
-rwxrwxrwx 1 amar amar 2054 Jul  8 20:44 filecat.txt
-rwxrwxrwx 1 amar amar 2054 Jul  8 20:44 filecat.txt

The file system I'm using is NTFS on both of my partitions. Using lsblk results in the following output

lsblk: failed to access sysfs directory: /sys/dev/block: No such file or directory

The answer provided in the linked question suggested editing a certain line in the etc/fstab file. My etc/fstab file contains only the following line

LABEL=cloudimg-rootfs   /        ext4   defaults        0 0
Oli
  • 293,335
bambooch
  • 1
  • 1
  • 5
  • 1
    Please [edit] and add the full output of this command line: ls -l filecat.txt; chown user1 filecat.txt; ls -l filecat.txt – on which filesystem is the file located? lsblk gives you a nice overview of block devices and their mountpoints. – dessert Jul 08 '19 at 20:22
  • lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT is even better, showing you the file system in the second column as well – IIRC, usual Windows file systems like NTFS and FAT don’t support POSIX file ownership. – dessert Jul 08 '19 at 20:33
  • I recall a similar problem and my solution was to boot into Ubuntu mount the WSL partition and change ownership. Of course if you don't have dual boot you would have to do it from Live USB which is a hundred times slower. – WinEunuuchs2Unix Jul 08 '19 at 22:05
  • The linked question is for Ubuntu on Linux not WSL – WinEunuuchs2Unix Jul 08 '19 at 22:12
  • Sadly I do not know much about filesystems at all. I'm just starting out with the Linux CLI and learning as I go, about filesystems too apparently :) The linked question was marked as a possible duplicate of mine, hence the clarification in the EDIT section. – bambooch Jul 08 '19 at 22:15
  • 1
    People don't realize you are talking about WSL from within WSL. The duplicate is for Windows from within Linux. @dessert Please consider retracting your close vote. – WinEunuuchs2Unix Jul 08 '19 at 23:24
  • I noticed something else today which may be of help. After restarting my machine I'm not able to make hard links to filecat.txt or any file on my desktop. A I recall it, I was able to do so last night.The error I get is Invalid cross-device link. I guess this pushes the problem origin towards my filesystem(NTFS) a bit more. – bambooch Jul 09 '19 at 13:10
  • And another thing I just noticed is that if I try to set a sticky bit up for a folder, the command chmod -v o+t folderName outputs mode of 'folderName' retained as 1777 (rwxrwxrwt) while using ls -l in the parent directory shows these permissions drwxrwxrwx for folderName. As I see it, it's the same issue as with chmod. – bambooch Jul 09 '19 at 13:53
  • @WinEunuuchs2Unix The same solution applies: for the moment, you cannot chown NTFS volumes: you need to do that in Windows. :-( See this answer here ¯\(ツ) – Fabby Jul 10 '19 at 19:36
  • @Fabby I'm talking about chown a Linux file structure inside NTFS, not a NTFS file structure inside NTFS. If you use a Windows App to change a Linux file structure inside NTFS you will corrupt the data because Windows Apps are not Linux file structure aware. On the other hand Linux Apps inside Ubuntu are Linux File structure aware, they are just operating inside NTFS which for some reason WSL didn't do for me. Clear as mud? – WinEunuuchs2Unix Jul 10 '19 at 22:57

1 Answers1

1

I had the same issue on my Windows 10 Ubuntu subsystem.

The d drive wouldn't let me change anything from root:root, even though whoami told me I was under my own user.

I then went to my home directory, and from there, everything worked as expected.

  • OK. But what do you mean under home directory? OP shows that he works in mnt/c/users/XYDesktop/ directory. Is it not home directory in his case? – Gryu Mar 12 '20 at 00:12
  • @Gryu yes, in my setup, the C drive contains my Ubuntu home directory. I'm not sure why this isn't working for bambooch - is "XY" the user that Ubuntu subsystem was installed for? Could it be there is a mismatch between the user Ubuntu subsystem is for and "XY"? – Thomas Amar Mar 12 '20 at 14:43