0

I was trying to set permissions on all of the files in a removable hard disk. I had tried chown and chmod on the disk address (i.e. /dev/sdb) but I still couldn't move files as a user. Then I tried to recursively set permissions and ownership on all files on the disk with

sudo chmod -R 666 /media/jdh/b041de7c-7698-44ae-a387-482ab9e60201/

and

sudo chown -R jdh /media/jdh/b041de7c-7698-44ae-a387-482ab9e60201/

Then when I checked the GUI if found all of the directories contained no files and all of the files were 0 bytes in size. To be sure I checked ran ls and found all of the files present and of reasonable size.

I don't know how the removable disk is formatted.

What has happened? How can I make the files visible in the GUI again?

ayNONE
  • 41
  • 3
    You are missing the execute permissions on directories, so you will not be able to open/view them. Are you using root user to view them or the jdh user? What are you trying to accomplish? Why not set them with 775 instead? – Karov Mar 11 '20 at 09:05
  • I'm just trying to move the files with user the user account. I didn't realize that files had to be executable to be viewable in the file manager. I'm not trying to open them I just want to see that they are there. – ayNONE Mar 11 '20 at 09:30
  • I ran the commands using 775 instead and I can see the files once more. Thank you – ayNONE Mar 11 '20 at 09:33
  • Would it be impolite of me to write an answer to this question using the information you provided me? – ayNONE Mar 11 '20 at 09:35
  • Not at all, go ahead! – Karov Mar 11 '20 at 12:27
  • also you can recursively copy files, whilst preserving permissions with cp -rp – Karov Mar 11 '20 at 12:29

1 Answers1

0

If a directory is not executable then it cannot be opened. chmod 666 removes execute privileges. If you use a different command like chmod 775 or chmod 777 then you will be able to see inside the directory again since they restore execute privileges.

ayNONE
  • 41