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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
05-26-2004, 05:24 PM
|
#1
|
Member
Registered: May 2004
Location: Västerås, Sweden
Distribution: Slackware Current
Posts: 228
Rep:
|
chmod deleted my files
I've just tried to use the chmod command to give my ordinary user account access to some files. It worked, but not the way I wanted it too... The files got erased, sort of... First all the directories "turned" into some filetype I've never seen, and when I clicked them, they disapeared. 50 gigs of music and programs, gone
The only thing I did was to follow what my linux manual said
As root in the console, I wrote something like chmod 666 followed by the dir name.
That isn't supposed to fuck up the files huh?
Can someone tell me what happened? How do I set filepermissions without destroying my files?
/Marcus
|
|
|
05-26-2004, 05:28 PM
|
#2
|
Moderator
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047
Rep:
|
I would be very suprprised if you delted them - can you post the output of:
ls -la /path/to/dir
mount
fdisk -l
|
|
|
05-26-2004, 05:35 PM
|
#3
|
Member
Registered: May 2004
Location: Västerås, Sweden
Distribution: Slackware Current
Posts: 228
Original Poster
Rep:
|
[anv@localhost removable]$ ls -la
totalt 164
drwxrwxrwx 6 root nogroup 32768 maj 27 19:28 ./
drwxr-xr-x 6 root root 4096 maj 27 18:49 ../
drwxrwxrwx 5 root nogroup 32768 maj 24 19:27 DC++/
drwxrwxrwx 4 root nogroup 32768 maj 4 09:55 Program/
drwxrwxrwx 4 root nogroup 32768 maj 6 09:37 Recycled/
drwxrwxrwx 5 root nogroup 32768 maj 27 19:28 .Trash-anv/
[anv@localhost removable]$ cd .
. .. .Trash-anv
[anv@localhost removable]$ cd .Trash-anv/
[anv@localhost .Trash-anv]$ dir
Abstract\ 04.zip Byakhee30 Joy\ Behrman.zip pm.zip Win\ Dragon.zip
AquaFish.zip Catarata.zip Macpack-1.zip Rawr\ the\ dragon.zip xp001.zip
Biohazard\ Titanium.zip docs Marcus.dat riders.zip
blue\ dragon.zip Dragon\ Windows\ XP.zip Optics.zip Saker
blue.zip electric4pack+matrix\ bonus.zip ph34r\ m3.zip Thumbs.db
[anv@localhost .Trash-anv]$
Saker is the dir I used chmod on.
What should I do?
---
Ok, now I've moved the files from .Trash, but I still can't get to them in nautilus. Mandrake doesn't register them as libraries but as something else. When I click them they disapear from the view. Is it me, or is this straaange?
Last edited by NonSumPisces; 05-26-2004 at 07:12 PM.
|
|
|
09-22-2007, 12:33 AM
|
#4
|
LQ Newbie
Registered: Sep 2007
Posts: 6
Rep:
|
I'm having the exact same problem (and it has happened a couple times before) with Ubuntu 7.04 and ReiserFS. It has only happened while setting the permissions of directories (as opposed to single files).
Honestly, this should have been fixed by now. It's been 3 years since this was first posted.
Last edited by nekoneko; 09-22-2007 at 12:40 AM.
|
|
|
09-22-2007, 12:41 AM
|
#5
|
Senior Member
Registered: Feb 2007
Location: Chilliwack,BC.Canada
Distribution: Slackware64 -current
Posts: 2,079
Rep:
|
this is why you always backup your data
|
|
|
09-22-2007, 12:43 AM
|
#6
|
LQ Newbie
Registered: Sep 2007
Posts: 6
Rep:
|
I had a backup from about 2 hours ago. I already remade everything that had been deleted. That's not the problem.
Chmod should NOT be deleting files. I want to know why it is.
By the way, the exact command I did was:
Quote:
sudo chmod -R 644 directory/
|
Last edited by nekoneko; 09-22-2007 at 12:53 AM.
|
|
|
09-22-2007, 01:01 AM
|
#7
|
LQ Addict
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908
|
Quote:
blue\ dragon.zip Dragon\ Windows\ XP.zip Optics.zip Saker
Saker is the dir I used chmod on.
|
Are you trying to set permissions on directories in a mswindows partition?
|
|
|
09-22-2007, 01:07 AM
|
#8
|
LQ Newbie
Registered: Sep 2007
Posts: 6
Rep:
|
I doubt that person will respond. It's a 3 year old post.
For me, I was setting permissions on a ReiserFS partition.
|
|
|
09-22-2007, 03:40 AM
|
#9
|
Senior Member
Registered: Jun 2006
Location: Maryland
Distribution: Kubuntu, Fedora, RHEL
Posts: 1,541
|
Permissions on a directory require the executable-bit be set. Thus a setting of 755, 775, or 777 would have been the appropriate choice; not the mark of the devil (666) which is read-write for owner, group, and world.
|
|
|
09-22-2007, 03:51 AM
|
#10
|
Senior Member
Registered: Feb 2007
Location: Chilliwack,BC.Canada
Distribution: Slackware64 -current
Posts: 2,079
Rep:
|
thats quite ironic
|
|
|
09-22-2007, 11:36 AM
|
#11
|
LQ Newbie
Registered: Sep 2007
Posts: 6
Rep:
|
That's pretty odd. Is there any particular reason directories need to be executable?
Also, when I ran `chmod 755` on a directory which I had earlier run `chmod 644` on, all the directories and files reappeared. To me, this really doesn't seem like reasonable behavior.
|
|
|
09-22-2007, 01:07 PM
|
#12
|
Senior Member
Registered: Jun 2006
Location: Maryland
Distribution: Kubuntu, Fedora, RHEL
Posts: 1,541
|
I didn't design Unix/Linux, so I myself do not understand the rationale either. All I know is that to traverse into a directory, it's permission must have that execute-bit set.
Earlier someone (perhaps you) wanted to change all of the permissions of the files within a directory to 644. In the future, be careful because you may also inadvertently change the permissions on a file that is meant to be executable (e.g. a script, an ELF executable, etc). These particular files also require the execute-bit set (well, not true for every script file).
Anyhow, if you are confident in what you are doing, either of these commands will work for you:
$ chmod -R 644 somedir/*
or:
$ find somedir -type f -exec chmod 644 {} \;
The second command (the 'find') is better in cases where the directory you are chmod-ing contains subdirectories.
Last edited by dwhitney67; 09-22-2007 at 01:10 PM.
|
|
|
09-22-2007, 01:24 PM
|
#13
|
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733
|
The execute bit means something else for directories than for files. It is "overloaded". A bit was needed to allow or deny access to directories, and they happened to pick the 'x' bit since running directories wouldn't make sense.
|
|
|
09-23-2007, 12:25 AM
|
#14
|
LQ Newbie
Registered: Sep 2007
Posts: 6
Rep:
|
That's rather annoying. One of my friends described it to me as an "enter" bit for directories rather than "executable", since it allows entry into the directory if set.
This behavior should probably be documented better. After a grep of the chmod man page, I did find information on this, but it certainly isn't noticeable under a casual read.
|
|
|
09-23-2007, 12:37 AM
|
#15
|
Senior Member
Registered: Jun 2006
Location: Maryland
Distribution: Kubuntu, Fedora, RHEL
Posts: 1,541
|
Quote:
Originally Posted by nekoneko
This behavior should probably be documented better. After a grep of the chmod man page, I did find information on this, but it certainly isn't noticeable under a casual read.
|
Perhaps so, but just accept it as a requisite. When you drive a car and want to pull-out onto a major roadway with an oncoming car signaling that it is going to make a turn (either left or right), do you just pull-on out, or do you wait for that car to actually make the turn? The correct choice is to wait for the other car to actually make the turn... but you won't find that documented anywhere either.
|
|
|
All times are GMT -5. The time now is 02:40 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|