LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-02-2010, 01:54 PM   #1
Friis
LQ Newbie
 
Registered: Nov 2010
Posts: 6

Rep: Reputation: 0
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?
 
Old 11-02-2010, 02:20 PM   #2
udaman
Member
 
Registered: Oct 2010
Location: New England, USA
Distribution: OpenSUSE/Slackware64/RHEL/Mythbuntu
Posts: 187

Rep: Reputation: 39
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.
 
Old 11-02-2010, 02:22 PM   #3
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
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 {} \;
 
Old 11-02-2010, 02:39 PM   #4
devnull10
Member
 
Registered: Jan 2010
Location: Lancashire
Distribution: Slackware Stable
Posts: 553

Rep: Reputation: 116Reputation: 116
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.
 
Old 11-02-2010, 02:41 PM   #5
Friis
LQ Newbie
 
Registered: Nov 2010
Posts: 6

Original Poster
Rep: Reputation: 0
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)
?>

Last edited by Friis; 11-02-2010 at 03:01 PM.
 
Old 11-02-2010, 04:20 PM   #6
devnull10
Member
 
Registered: Jan 2010
Location: Lancashire
Distribution: Slackware Stable
Posts: 553

Rep: Reputation: 116Reputation: 116
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.
 
Old 11-02-2010, 05:32 PM   #7
jv2112
Member
 
Registered: Jan 2009
Location: New England
Distribution: Arch Linux
Posts: 719

Rep: Reputation: 103Reputation: 103
Post

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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
10.04 oops dfowensby Ubuntu 7 02-27-2010 12:39 PM
Oops... Linux_n00b_57 Slackware 12 03-14-2006 11:20 PM
Oops!!! bigoli MEPIS 1 06-12-2005 04:36 PM
oops! nerdboy Linux - Networking 1 09-13-2002 03:29 AM
oops! Hano Linux - Networking 1 09-04-2001 09:21 AM


All times are GMT -5. The time now is 06:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration