Skip to main content
Welcome guest. | Register | Login | Post

chmod -x??

4 replies [Last post]
Offline
Joined: 2006-12-04

hi!

i accidentally typed "chmod -x /media/sda4" and forgot the filename. i tried to put it right with "chmod +x /media/sda4" now all of my folders on sda4 are "unknown". Icant open any folders on sda4 and i dont seem to have wrinting permission on the partition(fat32) help!

a thing's picture
Offline
Joined: 2005-12-20
no permissions

FAT32 has no support for permissions. The only thing that needs to be executable is the directory /media/sda4/ so you can enter it.

You might also want to fsck /dev/sda4

tbuitenh's picture
Offline
Joined: 2005-12-21
Please do "ls -l /media"

Please do "ls -l /media" and find the line for sda4. It should be:
drwxr-xr-x (something) root root (something, date and time) sda4
If the drwx... part is different, do "chmod 755 /media/sda4".

If the permissions for /media/sda4 are fine, but those for files or directories inside it aren't, try unmounting it and then mounting it again. FAT32 doesn't support permissions, but IIRC Linux can pretend it does. Unmounting and mounting again should stop this pretending.

If that doesn't help, try "chmod -R 755 /media/sda4"
This will set the same permissions for /media/sda4 and EVERY file and directory in it.

Quick explanation of "755": each number refers to a set of permissions. The first (7) is for the owner, the second for the group, and the third for others. The numbers are calculated this way:
allow noting: 0
allow execute/search: add 1
allow write: add 2
allow read: add 4
allow everything: 1 + 2 + 4 = 7
(so if you want to make a file (not directory) readable and writable by everyone, you "chmod 666" it Laughing out loud )

a thing's picture
Offline
Joined: 2005-12-20
tbuitenh wrote:Please do
tbuitenh wrote:

Please do "ls -l /media" and find the line for sda4.

Or have your computer do it for you with "ls -l /media|grep sda4".

tbuitenh's picture
Offline
Joined: 2005-12-21
finding past commands
a thing wrote:
tbuitenh wrote:

Please do "ls -l /media" and find the line for sda4.

Or have your computer do it for you with "ls -l /media|grep sda4".

I doubt typing "|grep sda4" is less work than spotting sda4 in a short sorted list.

Here's a more useful tip: next time you forget what command you typed, press control-r and then type the part of the command you do remember (for example -x). This will show you the last command containing "-x". If that's the wrong one, press control-r again, and again...
If you have closed the terminal after you ran the command you're looking for (or even switched off the computer), you may need to open a few terminals and try the control-r search in each of them. Don't close those in which you didn't find the command, because you will get the same one again when you open a "new" terminal!

If you don't remember the command at all, you might find it by pressing the up arrow key. Again, try in multiple terminal windows.

Comment viewing options