44

I wrote a /bash script and to execute it I decided to set all the rights, so I tried

chmod 777 * //I had 3 text files in the directory, so that's ok

Then to check the result I typed

ls -l

But the rights hadn't changed at all.

I haven't got any error messages and it seems strange. I also tried to specify full path, but this hadn't helped.

I also tried to do all of these steps under root

Where may be the problem?


Thank you for help!


ls -la

drwx------ 1 gemma gemma 4096 июля  20 18:00 .
drwx------ 1 gemma gemma 4096 июля  20 16:35 ..
-rw------- 1 gemma gemma  407 июля  20 18:00 buildedfile.out   ;this is what I
                                                               ;need to launch
-rw------- 1 gemma gemma 4096 июля  20 17:21 kernel.bin
-rw------- 1 gemma gemma  350 июля  20 16:59 link.ld
-rw------- 1 gemma gemma 2025 июля  20 17:59 main.c
-rw------- 1 gemma gemma 1894 июля  20 17:34 start.asm
-rw------- 1 gemma gemma  457 июля  20 17:20 start.o

That is what ls shows after all I tried


I rebooted PC and problem rose again. But now any of suggested methods doesn't help.


I'm using Linux Mint 13 32-bit. On main disk where this files are located I have ext3, also tried on two another partitions where I have ntfs and FAT32.


buildedfile.out is a terminal app written on C

8
  • Did you get an error from the chmod command?
    – Fran
    Jul 20, 2012 at 14:45
  • did you try chmod 777 /path/to/folder/*
    – user98645
    Jul 20, 2012 at 14:48
  • Please post the output of ls -la
    – deppfx
    Jul 20, 2012 at 14:59
  • Try the verbose switch: chmod -v 777 *
    – Dennis
    Jul 20, 2012 at 15:23
  • 1
    Which filesystem are you using?
    – Matteo
    Jul 20, 2012 at 15:48

4 Answers 4

59

I had this same problem, the partition I was accessing was an ntfs partition mounted with ntfs-3g (with no permission support by default), and it took a while for me to remember that.

I would expect chmod to give me some warning, but it didn't just like in your case.

I know there is an option on fstab when using ntfs-3g to make it possible to set permissions in an ntfs partition as described here.

I hope it helps.

2
  • 3
    That can happen on a vagrant box as well which was the case for me. So, I changed the permission of the directory from within host system. Et voila, permission granted on virtual machine. Thanks for the hint. :)
    – Arvid
    Mar 20, 2017 at 15:49
  • 2
    tldr: mount -o permissions /dev/...
    – phil294
    Jun 7, 2018 at 4:45
7

Try: sudo chmod -R -f 777 *

I think that can be a permission issue.

0
4

Are you sure your filesystem is not mounted read only ?

Type mount command to check. if there is ro in the mount options, you need to remount your filesystem with the following command :

mount -o rw /dev/ /mountpoint

You can also check which user owns the shell script.

If it's not "gemma" it could be the cause of the problem.

1
2

(Might be the problem of some future readers:) @VinGarcia's answer is correct but specifically in case you're using WSL and you're trying to chmod/chown in "Windows files" mounted on the /mnt/ path, it is not allowed by default.

In this case, you have two options. Either use the WSL's filesystem (which is not mounted, e.g., your home at ~) and it's allowed there, or create an /etc/wsl.conf and add this to it:

[automount]
options = "metadata"

Then in CMD run wsl --shutdown. Re-open a new wsl terminal window and now it must work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.