LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   oops, files gone? (https://www.linuxquestions.org/questions/linux-newbie-8/oops-files-gone-841949/)

Friis 11-02-2010 01:54 PM

oops, files gone?
 
i was trying to make a script to redo a chmod on a folder every 15min. by using crontab (*/15 * * * * /(link to script.sh)

now i didn't know much about the use of the scrips so i just write in the command i would in terminal
chmod -R 664 /data/
i try to run the script in terminal and now i can't see the files in that folder. but acording to the folder properties, i am still using the disc space where the data use to be, so the data in the folder doesn't seem to be deleted.

the main focus i want is how to get the data back. scripting and others can come later.

how can i get to see my data again?

udaman 11-02-2010 02:20 PM

chmod will not make your data disapear. What makes you think your files are gone? What is the message you get when you do "ls -l" on the data directory? Paste that output here. You can restore the original permissions, if you know what they were.

catkin 11-02-2010 02:22 PM

The data is there, you have just stopped yourself from listing the directory contents (the "execute" bit on a directory allows its contents to be listed).

Quick fix by

find /data -type d -exec chmod +x {} \;

devnull10 11-02-2010 02:39 PM

Although I'm not sure exactly what your requirements are, you probably want your script to read:
Code:

chmod -R 775 /data/
which would give read/write access to the owner and group and read access to others. As said above, the execute bit is required to allow users to list the contents. If you don't want others to be able to do that then chmod the others bit to remove the execute flag, just be sure that the owner (and if applicable the group) have it set.

Friis 11-02-2010 02:41 PM

yeah i see the files now again. (chmod wikipedia confused me)
did a chmod 775 -R on the folder

what about the script?
don't know much about it, the only place i could find a chmod in script was php

can i use that?
<?php>
chmod("/data/",-R,775)
?>

devnull10 11-02-2010 04:20 PM

You can use if if 775 are the permissions you wish to grant to that directory. Without knowing exactly what you are wanting to do, it is a difficult one to call. Post the output from

Code:

ls -l /data/
and we will be able to tell you what effect 775 will have on it.

jv2112 11-02-2010 05:32 PM

Below is some notes on how the numeric octal codes and how it breaks out into permissions and what it may mean if applied.

Quote:

Octal
4-Read
2-Write
1-Execute

The Sum of each of these give all the permissions so 5 would be Read & execute (4+1) and 6 would be Read and write. The order in which you place them determines who gets that permission.

Group Order
u-User/Owner ( 1st # - so 7 in 755)
g-Group ( 2nd # - so 5 in 755)
o-Others ( 3rd # - so second 5 in 755)
a- All ( all 3 )


r - Read permission. Whether the file may be read. In the case of a directory, this would mean the ability to list the contents of the directory.


w - Write permission. Whether the file may be written to or modified. For a directory, this defines whether you can make any changes to the contents of the directory. If write permission is not set then you will not be able to delete, rename or create a file.


x - Execute permission. Whether the file may be executed. In the case of a directory, this attribute decides whether you have permission to enter,run a search through that directory or execute some program from that directory.


Hope this helps.:study:


All times are GMT -5. The time now is 03:55 PM.