UMASK in Linux: How to set permission with UMASK ?

UMASK  : Permission Set When New File / Folder Created

UMASK known as User Mask or it is also called User File creation MASK. This is a kind of base permission or default permission given when new file or folder is created in Linux box. Most of the distribution of Linux gives 022 as default UMASK.

So 022 is the default permission for files and folders

while create any file or directory in Linux, they are governed by umask setting. In case, any system administrator does not set the default umask will be 0000. This means that the new files created will have read and write permissions for each user and new directories will have read, write and execute permissions.

How can we calculate UMASK in Linux?

One thing is umask value is generally same for files and folders but the calculation of these values based on the permissions on files and directories are different.

Minimum UMASK value for directory : 000 and Maximum : 777
Minimum UMASK value for file: 000 and Maximum : 666

Reason of keeping maximum value 666 for files is because script files and binary files in Linux should only have execute permissions. Normal files in Linux should only have read and write permissions. Normally, umask are calculated through bitwise AND operator. Some of the common octal notations are:

0 – Read, Write and Execute
1 – Read and Write
2 – Read and Execute
3 – Read Only
4 –Write and Execute
5 –Write Only
6 –Execute Only
7 –No Permissions

Now, we can easily make use of the above mentioned table to calculate permission for files. For instance, if an umask is set to 077 means the permission is generally calculated as below:

Targeted at
File permission
read, write and execute
No permissions
No permissions

To set the above umask, you should type the command

$ umask 077
$ mkdir folder3
$ touch testfile3
$ ls –ld folder3  testfile3

drwx—— 2 demo demo 4096 2013-07-04 01:34 folder3
-rw——- 2 demo demo 0 2013-07-04 01:34 testfile3

Display current umask value

If you run umask command without any argument it will display the current mask value.

$ umask

How can we set umask with Symbolic Values?

Below mentioned are the symbolic values we can use:
r: read, w: write, x: execute, u: user ownership, g: group ownership and o: other ownership

$ umask u=rwx, g=, o=
$ mkdir folder1
$ touch testfile
$ ls –ld folder1 testfile

Procedure To Setup Default umask

You can setup umask in /etc/bashrc or /etc/profile file for all users. By default most Linux distro set it to 0022 (022) or 0002 (002). Open /etc/profile or ~/.bashrc file, enter:

# vi /etc/profile
$ vi ~/.bashrc
Append/modify following line to setup a new umask:
umask 022

Save and close the file. Changes will take effect after next login. All UNIX users can override the system umask defaults in their /etc/profile file, 

~/.profile (Korn / Bourne shell) 
~/.cshrc file (C shells), 
~/.bash_profile (Bash shell)
~/.login file (defines the user's environment at login).

umask and level of security:

The umask command be used for setting different security levels as follows:

umask value
Security level
Effective permission (directory)

What are the Limitations of umask?

  1. The umask command can restricts permissions.
  2. The umask command cannot grant extra permissions beyond what is specified by the program that creates the file or directory. If you need to make permission changes to existing file use the chmod command.

Migrate physical to virtual Machine using Converter

Below Video will explain how to migrate a physical machine in to virtual machine.

Converter Down Load Link :

Copy file to USB-stick

# mount USB-stick:

# mkdir /mnt/usbstick

# mount –t vfat /dev/sdb1 /mnt/usbstick

copy archive file to home folder:

#cd /mnt/usbstick

#cp VMware-converter-4.0.1-161434.tar.gz ~

#cd ~

#tar –zxf VMware-converter-4.0.1-161434.tar.gz

#cd vmware-converter-distrib

# ./

Follow the instructions

Run VMware Converter:


Microsoft ODBC Driver installation on Linux

The Below post will explain how to install Microsoft ODBC driver on Linux server.

Here i have installed on Redhat Linux 5.8 server

Why we need ODBC driver?

The Microsoft ODBC Driver For SQL Server provides native connectivity from Windows to Microsoft SQL Server and Windows Azure SQL Database.

Prerequisites for Installing

This driver is only supported on 64-bit Red Hat Enterprise Linux 5 or
64-bit Red Hat Enterprise Linux 6. Other configurations are not supported
and will not likely work.

The following libraries must be installed for the driver to work:

RedHat 5:

RedHat 6:

Most likely these libraries are installed, as they should come installed by
default on the supported versions of RedHat Linux.

Important: Delete any driver manager packages installed on your computer before you install the unixODBC Driver Manager. Installing the unixODBC Driver Manager could cause a failure of an existing Driver Manager.

The installation script can verify most of these configuration
prerequisites by running:

./ verify

Step 1:

Down load the ODBC Driver Manager from below link. This driver manager will help to install ODBC Driver in linux server

File name : msodbcsql-11.0.2270.0.tar.gz

Copy the downloaded file to server /tmp directory

#tar -zxvf msodbcsql-11.0.2270.0.tar.gz

#cd msodbcsql-11.0.2270.0

#./ --help  ( Check the available command options in build command)

What If The Driver Manager Isn't Configured Properly?

You may build a properly configured unixODBC Driver Manager using the script included.  However, if this script is unable to
complete, you may configure and build the proper driver manager yourself
using the instructions below:

Step 2 : 

1. Remove any older installed version of unixODBC (for example, unixODBC
2.2.11).  On Red Hat Enterprise Linux 5 or 6, you can do this by executing
the following command: yum remove unixODBC.

2. Go to

3. Click the Download link, on the left side of the page.

4. Click the Download link, on the next page, and save the file
unixODBC-2.3.0.tar.gz to your computer.

5. On your Linux computer, execute the following command: tar xvzf

6. Change to the unixODBC-2.3.0 directory.

After copy the file you will get files like below in  your directory.

Step 3:

Copy the downloaded driver to below location 

#cp /tmp/unixODBC-2.3.0.tar.gz /tmp/msodbcsql-11.0.2270.0

Execute the following command to begin the unixODBC Driver Manager installation: 

#./ --download-url=file://unixODBC-2.3.0.tar.gz.

#cd /tmp/unixODBC.5062.15565.23677/unixODBC-2.3.0; make install

#cd /tmp/msodbcsql-11.0.2270.0

# ./ install

#./ verfiy

You can confirm the ODBC driver installed on server using below command

# odbcinst -q -d -n "ODBC Driver 11 for SQL Server"

Blogger Tips and TricksLatest Tips And TricksBlogger Tricks