Click to See Complete Forum and Search --> : How did they do that ...


anton
06-18-2001, 03:47 PM
Hello,

well , I have hostway.com hosting, and there I'm in directory /home/anton/www let's say ... I can walk everywhere on there ... even in '/' ... but I don't see any file in any directory, besides my own directory ...

so, how did they acomplish that ? and how can I do the same?

thanks.

fancypiper
06-18-2001, 03:59 PM
It's all done with permissions. You don't have permission to access anything but your stuff on that machine.

See the File Permissions (http://www.linuxnewbie.org/nhf/intel/filesys/fileperms.html) NHF

GonzoJohn
06-18-2001, 04:09 PM
If you're just lazy, they did it by disabling the read permissions for all directories other than those owned by you. That's what those rwx------ permission things do ;-)

anton
06-18-2001, 04:29 PM
well , that I can't understand, I understand how to enable permission on certain files/directories for certain users/groups ... but I don't understand, how can I disable them ??

thanks...

godot
06-18-2001, 04:33 PM
chmod a+rwx u+rwx g+rwx o+rwx <filename>

a = everybody
u = user that owns file
g = group that owns file
o = other

so if you want your user to be able to write, group to be able to read, and other to do nothing type:
chmod u+rw g+r o-rwx <filename>

+ adds permissions
- subtracts permissions

get it?

also:
directories need to be executable
so +x for all directories if you want to read it

Craig McPherson
06-18-2001, 06:01 PM
Numeric permissions are simplier IMHO

1 - eXecute
2 - Write
4 - Read

R + W + X = 4 + 2 + 1 = 7

751 = RXW for owner, RX for group, X for world.

anton
06-18-2001, 06:33 PM
yes, it looks like it simplier : ) ... well , thanks all , got that working, and I think, I understood permissions finally ;)

by the way , why is it 1,2,4 ... why not 3 ?

thanks

Droo
06-18-2001, 06:50 PM
It's binary math...

If you said chmod 3, the computer wouldn't know if you meant Read(3) or Write + Execute (1+2).

neotrace
06-18-2001, 06:57 PM
so when i'm trying to get these damn cgi-scripts to work i should chmod 755 = rwx-rx-rx?

anton
06-18-2001, 07:13 PM
Droo : thanks, that's was stupid of me even asking :rolleyes:

Craig McPherson
06-18-2001, 07:29 PM
Yes, scripts need to be a+rx in order for the web server to run them.