Chmod With Examples Along With Quick Reference

July 1st, 2018, posted in Solaris
Share

What is chmod ?

chmod ( Change Mode ) is a command line utility in Unix , Linux and other Unix like systems to change the read, write, execute permissions of a file for owner , group and others.

How to use chmod?

Chmod command is used in two ways :
1. Using octal value & position : Sets the permission for owner, group and others with octal values , 4 for read , 2 for write , 1 for execute and any sum of these number to get cumulative permissions.

chmod syntax using octal mode
chmod [OPTION] MODE FILE

2. Using symbolic values to add, remove the file permission
u for user , g for group , o for others a for all ; r for read , w for write , x for execute , + , – & = for adding , removing and assigning r w x permissions.

chmod syntax for symbolic values
chmod [OPTION] MODE1,MODE2 FILE

3. chmod options

-R – Recursively change the permissions in the file under the directory.

chmod examples using octal mode :

  • First column shows the chmod command ,
  • second column shows how the value is calculated for the permission
  • last columns of owner, group, others shows individual octal values and actual bit set on file as seen by ls -l.
  • For setting any other permission combination for owner, group & other , pick corresponding value from each column and use with chmod command , for example chmod 264 file , chmod 400 file , chmod  755 file etc.
OWNER GROUP OTHERS
Permissions Value octal value & bit set
rwx
Read write Execute
$chmod 777 file
4+2+1 7
rwx
7
rwx
7
rwx
rw
Read & Write
$chmod 666 file
4+2 6
rw_
6
rw_
6
rw_
rx
Read & Execute
$chmod 555 file
4+1 5
r_ x
5
r_ x
5
r_ x
r
Read only
$chmod 444 file
4 4
r_ _
4
r_ _
4
r_ _
w
Write only
$chmod 222 file
2 2
_w_
2
_w_
2
_w_
x
Execute only
$chmod 111 file
1 1
_ _ x
1
_ _ x
1
_ _ x

chmod examples using symbolic mode :

Symbol are used to assign the permissions :

  • u – user , g – group,  o – others ,  a – all
  • +  to add permission  ,    to remove permission ,  = to assign permission
  • r w x   is used for read , write,execute ,  s  is used to set the sticky bit

Examples

  • chmod  ug+x file   ;  assign execute permission to user and group in file
  • chmod a+x  <file>  ;  assign execute permission to all in file
  • chmod o-x  <file>  ;  remove execute permission to others in file
  • chmod go+r  <file>  ;  assign read permission to group & others in file
  • chmod u+rwx ,g+rw,o+r  file

Special permissions – sticky bit , setuid , setguid bit

sticky bit

when sticky bit is set the file or script is kept in swap space and loaded in to memory on next request. This makes memory loading faster.

sticky bit is represented by t in symbol mode , for example

$chmod +t file.sh

In octal mode sticky bit is represented by 1

$chmod 1755 file.sh

Set user id – setuid and set group id –  setguid bits

when these bits are set for user or groups , they are given effective permission of owner of the file during run time

for example , if file.txt is owned by root and you need to give just run time root permission to some user , you can set the setuid for file.

Following examples sets the setuid , setguid on file along with normal 755 permission.

$chmod 4755 file.txt

you need to give just run time root permission to some group of users , you can set the setgid for file.

$chmod 4755 file.txt

Share

Oracle EBS Query To Check FND Languages Installed in Oracle

June 26th, 2018, posted in Oracle Queries
Share

 

clear columns
set lines 180
set pages 50
col LANGUAGE_CODE for a15
col NLS_LANGUAGE for a20
col ISO_LANGUAGE for a15
col INSTALLED_FLAG for a15
SELECT LANGUAGE_CODE,NLS_LANGUAGE, ISO_LANGUAGE,INSTALLED_FLAG 
FROM APPS.FND_LANGUAGES 
WHERE INSTALLED_FLAG IN ('B','I');
Share

ORA-00704 Bootstrap Process Failure

June 24th, 2018, posted in Oracle Queries
Share

ORA-00704 bootstrap process failure

After Upgrading ORACLE_HOME (from 10.2.0.1 to 10.2.0.4), I was started my database by using startup command, then got below error.

 

ORA-01092 oracle instance terminated. Disconnection force.

After I saw my alert log and got ORA-00704 error,

Alert Log :

 

Errors in file /oracle/product/db/10.2.0/dbhome/admin/test/udump/test_ora_11338.trc:

ORA-00704: bootstrap process failure

ORA-39700: database must be opened with UPGRADE option

Wed Jun 19 11:43:30 2013

Error 704 happened during db open, shutting down database

USER: terminating instance due to error 704

Instance terminated by USER, pid = 11338

ORA-1092 signalled during: ALTER DATABASE OPEN....


Solution:

I missed to run catupgrd.sql script after upgrade, so got above errors while starting the database.

 

Go to ORACLE_HOME/rdbms/admin

sqlplus / as sysdba

sql>startup upgrade

sql>@catupgrd.sql 

sql>@utlrp.sql

sql>shut immediate

sql>startup
Share

About Bruce Lee

June 20th, 2018, posted in ChARACtERs, DAtEs iN a YeAR, MESSAGEs, POEPLes, Scarface'S DIARY
Share

Inspiring Quotes,Inspiring Bruce Lee,,Bruce Lee,Bruce, Lee, Quotes,Bruce Lee Quotes,lee,bruce lee,Bruce Lee Grave

Bruce Lee (born Lee Jun-fan; 27 November 1940 – 20 July 1973) was a Chinese American Hong Kong actor, martial arts instructor, philosopher, film director, film producer, screenwriter, and founder of the Jeet Kune Do martial arts movement. He is widely considered by many commentators, critics, media and other martial artists to be the most influential martial artist and pop culture icon of the 20th Century. He is often credited with changing the way Asians were presented in American films.

Share

Other Ways To Take Trace in Oracle Application

June 16th, 2018, posted in Oracle Queries
Share

Problem sys@standby> startup mount; ORACLE instance started. Total System Global Area 835104768 bytes Fixed Size 2217952 bytes Variable Size 490735648 bytes Database Buffers 335544320 bytes Redo Buffers 6606848 bytes Database mounted. sys@standby> alter database recover managed standby database using current logfile disconnect; alter database recover managed standby database using current logfile disconnect * ERROR at line 1: ORA-01153: an incompatible media recovery is active Cause This indicates a currently running media recovery process. Action sys@standby> alter database recover managed standby database cancel; sys@standby> alter database recover managed standby database using current logfile disconnect; Note When shutting down physical standby database, firstly turn off media recovery process. Otherwise the next time when starting up redo apply again, you will encounter error ORA-01153.

Other Ways To Take Trace in Oracle Application :

 

 

SQL> ALTER SESSION SET sql_trace=TRUE;
SQL> ALTER SESSION SET sql_trace=FALSE;

SQL> EXEC DBMS_SESSION.set_sql_trace(sql_trace => TRUE);
SQL> EXEC DBMS_SESSION.set_sql_trace(sql_trace => FALSE);

SQL> ALTER SESSION SET EVENTS '10046 trace name context forever, level 8';
SQL> ALTER SESSION SET EVENTS '10046 trace name context off';

SQL> EXEC DBMS_SYSTEM.set_sql_trace_in_session(sid=>123, serial#=>1234, sql_trace=>TRUE);
SQL> EXEC DBMS_SYSTEM.set_sql_trace_in_session(sid=>123, serial#=>1234, sql_trace=>FALSE);

SQL> EXEC DBMS_SYSTEM.set_ev(si=>123, se=>1234, ev=>10046, le=>8, nm=>' ');


Share