Call (800) 766-1884 for Oracle support & training
Free Oracle Tips


Oracle Consulting Support
Oracle Upgrades
Use New Oracle Features
Oracle Replication Support
Oracle Training
Remote Oracle DBA
System Documentation
Oracle Tips
Oracle Performance
 

Free Oracle Tips


 

HTML Text

BC Oracle tuning

Oracle training

Oracle support

Remote Oracle

 

 

   
 

Oracle UNIX chmod Letter Designations

Oracle 11g New Features Tips by Burleson Consulting

Advanced Oracle Utilities: The Definitive Reference by Rampant TechPress is written by top Oracle database experts (Bert Scalzo, Donald Burleson, and Steve Callan).  The following is an excerpt from the book.

UNIX chmod Letter Designations

As has been already noted, the chmod command can be used with letter-based permission masks, as shown in Table 2.4.

Owner (u)

Group (g)

World(o)

Meaning

rwx

Rwx

rwx

Read + Write + execute

rw

Rw

rw

Read + Write

rx

Rx

rx

Read + execute

wx

Wx

wx

Write + execute

R

R

r

Read only

w

W

w

Write Only

x

X

x

Execute only

Table 2.4:  The UNIX Chmod Letter Designations

 

Note how this works.  In the absence of a designator (u, g, or o), the chmod command makes the change for owner, group and world.  In the chmod command below, make all .ksh files executable for all users:

 

root> ls –al

-rw-r--r--   1 oracle   dba            0 Sep  3 15:40 t.exe
-rw-r--r--   1 oracle   dba            0 Sep  3 15:40 u.ora
-rw-r--r--   1 oracle   dba            0 Sep  3 15:40 v.sql

root> chmod +x *

root>ls –al

-rwxr-xr-x   1 oracle   dba            0 Sep  3 15:40 t.exe
-rwxr-xr-x   1 oracle   dba            0 Sep  3 15:40 u.ora
-rwxr-xr-x   1 oracle   dba            0 Sep  3 15:40 v.sql

The same operation can be done with the numeric chmod command.  Since the execution permissions are 644, 755 is used to make all files executable:

root> ls –al

-rw-r--r--   1 oracle   dba            0 Sep  3 15:40 t.exe
-rw-r--r--   1 oracle   dba            0 Sep  3 15:40 u.ora
-rw-r--r--   1 oracle   dba            0 Sep  3 15:40 v.sql

root> chmod 755 *
root> ls –al

-rwxr-xr-x   1 oracle   dba            0 Sep  3 15:40 t.exe
-rwxr-xr-x   1 oracle   dba            0 Sep  3 15:40 u.ora
-rwxr-xr-x   1 oracle   dba            0 Sep  3 15:40 v.sql

 

As noted, the chmod command can be prefaced with a reference to the user (u), group (g) or others (o).  Consider the following chmod command to allow others (o) to get write and execute permission:

root> ls –al

-rw-r--r--   1 oracle   dba            0 Sep  3 15:40 t.exe
-rw-r--r--   1 oracle   dba            0 Sep  3 15:40 u.ora
-rw-r--r--   1 oracle   dba            0 Sep  3 15:40 v.sql

root> chmod o+wx *
root>ls –al

-rw-r--rwx   1 oracle   dba            0 Sep  3 15:40 t.exe
-rw-r--rwx   1 oracle   dba            0 Sep  3 15:40 u.ora
-rw-r--rwx   1 oracle   dba            0 Sep  3 15:40 v.sql

Note that this is equivalent to changing the permissions from 644 to 647 as shown below:

root> ls –al

-rw-r--r--   1 oracle   dba            0 Sep  3 15:40 t.exe
-rw-r--r--   1 oracle   dba            0 Sep  3 15:40 u.ora
-rw-r--r--   1 oracle   dba            0 Sep  3 15:40 v.sql

root> chmod 647 *
root> ls –al

-rw-r--rwx   1 oracle   dba            0 Sep  3 15:40 t.exe
-rw-r--rwx   1 oracle   dba            0 Sep  3 15:40 u.ora
-rw-r--rwx   1 oracle   dba            0 Sep  3 15:40 v.sql

The chmod command can also be used to revoke permissions on file.  As seen in the next example, revoke all permissions for read, write and execute access for everyone except the owner.  In effect, the permissions are being changed from 647 to 700:

root> ls –al

-rw-r--rwx   1 oracle   dba            0 Sep  3 15:40 t.exe
-rw-r--rwx   1 oracle   dba            0 Sep  3 15:40 u.ora
-rw-r--rwx   1 oracle   dba            0 Sep  3 15:40 v.sql

root> chmod 700 *
root> ls –al

-rwx------   1 oracle   dba            0 Sep  3 15:40 t.exe
-rwx------   1 oracle   dba            0 Sep  3 15:40 u.ora
-rwx------   1 oracle   dba            0 Sep  3 15:40 v.sql

 

Using chmod to save an Oracle password in a UNIX file: There are times when there are shell scripts that access Oracle and want to store the Oracle password in a UNIX file, such that only the UNIX oracle user can read the file.

In this example, create a file with the Oracle SYSTEM password and chmod the file so that only the UNIX oracle user can view the contents:

root>echo manager>system_password.file
root> chmod 400 *.file
root> ls –al

-r--------   1 oracle   dba            8 Sep  3 16:17 system_password.file

This technique is very useful when one wants to write a shell script to access Oracle and keep the password in a single file.

 

In addition, the chmod command also has a set of plus operators (+) that can be used to add read, write, or execute permissions to a file.  Some Korn shell scripts are being changed and it is best to make them unexecutable for everyone until the change has been completed:

root> chmod -x *.ksh
root> ls -al *.ksh

-rw-r--r--   1 oracle   dba          205 May 10 09:11 a.ksh
-rw-r--r--   1 oracle   dba          303 May 10 09:11 lert.ksh
-rw-r--r--   1 oracle   dba          312 Jul 19 11:32 back.ksh
-rw-r--r--   1 oracle   dba          567 May 10 09:12 coun.ksh

Once the maintenance is complete, the scripts can again be made executable with the chmod +x command:

 

root> chmod +x *.ksh
root> ls -al *.ksh

-rwxr-xr-x   1 oracle   dba          205 May 10 09:11 a.ksh*
-rwxr-xr-x   1 oracle   dba          303 May 10 09:11 lert.ksh*
-rwxr-xr-x   1 oracle   dba          312 Jul 19 11:32 back.ksh*
-rwxr-xr-x   1 oracle   dba          567 May 10 09:12 coun.ksh*

The savvy DBA will write up a ‘cheat sheet’ with the basic numeric settings for the chmod commands, and post it in a handy location.

A very important area of Oracle UNIX administration, the management of UNIX directories, will be examined next.

 

Directory Management in UNIX


Detailed below are the UNIX commands that are used to create, manage and navigate between UNIX directories. 

 

 

 

 

  
 

Oracle performance tuning software 
 
 
 
 

Oracle performance tuning book

 

 
 
 
Oracle performance Tuning 10g reference poster
 
 
 
Oracle training in Linux commands
 
Oracle training Excel
 
Oracle training & performance tuning books
 

 

   

Copyright © 1996 -  2011 by Burleson Enterprises. All rights reserved.

Oracle® is the registered trademark of Oracle Corporation. 

Hit Counter