Help - Search - Members - Calendar
Full Version: Bash Command
Linuxhelp > Support > Technical Support
Iynx
What's the bash command to make a file on a linux websurver writable by everyone. It's chmod something, but what are the numbers?


-Iynx
digitalturbulence
QUOTE (Iynx @ Apr 26 2003, 06:54 PM)
What's the bash command to make a file on a linux websurver writable by everyone. It's chmod something, but what are the numbers?


-Iynx

chmod 666 your_file

But be carefull, some users could abuse about this right.

To calculate yourself the values:

1 execute
2 read
4 write

so if we want for the user only read and write, I make: 2 + 4 = 6
if we want the same for the group and the others, it will be at the end: 666
if you want also executable attribute, then it's: 777
Iynx
What would the code be then to secure it?


-Iynx
Joey
How do I view/change permissions on files/directories?
There are 3 different attributes a file can have that make up the permissions for the file.
There is read access that allows users to read the file.
There is write access that allows users to modify the file.
There is executable access that allows users to execute the file.

From these three attributes, you now have three different levels of permissions, the first being for the owner of the file, the second being for the group the file belongs to and the third being all other users on the system.

To view the current permissions on files and directories run the following command:
ls -l and you should see something that looks like:


drwxrwxr-x 3 joey html 4096 Sep 12 2000 images/
-rw-rw-r-- 1 joey html 267 Aug 8 12:55 index.shtml


The above shows you that images is a directory (d) and that the owner and group (joey html) have read ®, write (w) and execute (x) permissions while other users on the system only have read ® and execute (x) permissions.
For the index.shtml file, it shows joey and html as the owner and group and they both have read and write access to the file. It also shows that other users on the system only have read access. Note there is no executable permission since the file is not an executable.

To modify the permissions on a file, you either have to own it or be logged in as root. To modify the permissions, in a terminal type:
chmod xxx filename/directory
You will have to replace the xxx flags with the permissions you wish to change. You can either go by the numerical value or by the actuals. For more information, in a terminal, type man chmod

http://www.linuxhelp.ca/newbies/
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2017 Invision Power Services, Inc.