hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Hosting Security and Technology : Hosting Security and Technology Tutorials : How to Chmod a File
Reply

Hosting Security and Technology Tutorials Tutorials related to server security or the like.
Forum Jump

How to Chmod a File

Reply Post New Thread In Hosting Security and Technology Tutorials Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 01-20-2004, 02:56 AM
Crucial Crucial is offline
Boston Colocation and VPS
 
Join Date: Dec 2003
Location: Boston, MA
Posts: 592

How to Chmod a File


What is chmod?

chmod means change mode, you need this file to tell the sytem how to read, write or execute files. Belive it or not ALL files have these set. There set either by the program, user or system.

* start *

Your chmod command allows you to chmod using 3 basic numbers, they are as follows. 4,2,1 ... later you will be adding these numbers to determine the proper chmod.

Your chmod also gives you 3 groups to chmod to Owner, Group and Public. Remeber this order it will NEVER change.

Owner = In the following examples root is the owner, in general who ever is the owner of the file
Group = If the file is in a group, the group permissions
Public = All users

The letters to indicate read, write and execute as we spoke about in the first paragraph are as follows "r" "w" "x", these will also NEVER change order.

Here is a layout:

Owner ---- Group ---- Public
4-2-1 ---- 4-2-1 ----- 4-2-1
r-w-x ---- r-w-x ------ r-w-x

Lets check a ls -la of some files we want to change:

-rw-r--r-- 1 root wheel 1790 Nov 30 00:15 test1
-rw-r--r-- 1 root wheel 818 Nov 30 00:15 test2
-rw-r--r-- 1 root wheel 1663 Nov 30 00:15 test3

Example 1 ( I want test1 to have Owner read, write and execute, group to have read and public to have read)

You would look under Owner tab, see the rwx, thats 421 add those it comes to 7. Now look under group read is a 4 (you dont need more more permissions so dont add them its only a 4). Now look under Public same thing its only a 4 dont add nothing).

The correct chmod would be # chmod 744 test1

Example 2 ( Change test2 to read, write, execute for all Owner, Group, Public)

Correct chmod would be # chmod 777 test2

Example 3 ( change test3 for Owner Write, Group Read and Public read )

Correct chmod would be # chmod 244 test3


Keep in mind ROOT can READ, WRITE and EXECUTE anything it wants too.


QUICK TIPS:

chmod +x sets a file "Execute"
chmod -x set a file "No Execute"
chmod +s sets a file "Set UID"
chmod -s sets a file "NO Set UID" (Some files NEED setuid BE CAREFULL with this one).

NOTE:

Please read the manual, these commands are REALLY basic you can get in depth with chmod after some reading.


Good Luck and be carefull.


Last edited by Akash; 01-20-2004 at 05:26 PM.
Reply With Quote


Sponsored Links
  #2  
Old 01-20-2004, 05:13 PM
Akash Akash is offline
Web Hosting Master
 
Join Date: Jan 2001
Location: Illinois, USA
Posts: 7,147
Very well written - thank you very much

Reply With Quote
Reply

Related posts from TheWhir.com
Title Type Date Posted
Gladinet Launches Cloud Enterprise Service to Access SAN as a Private Cloud Web Hosting News 2013-03-28 14:19:44
BitTorrent to Launch Cloud Storage Service Web Hosting News 2013-01-25 15:39:23
File Sharing Service RapidShare Changes Traffic Model to Deter Piracy Web Hosting News 2012-11-09 12:16:35
SingleOS Launches Fuscan Linux Cloud 2.0 Web Hosting News 2011-08-12 19:09:05
Web Host WebHostingBuzz Partners with Cloud Platform SMEStorage Web Hosting News 2011-06-01 18:10:25


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

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 On
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?