Chmod file permission using bits.

This is the other method of giving file permission using bits.

we are having 3 different roles of symbolic representation.The representation given below:

  • user,
  • group,
  • others.

And the file/directory permissions are :

  • read permission,
  • write permission,
  • execute permission.

Numeric values for the read, write and execute permissions:

  • read 4
  • write 2
  • execute 1

Octal representation for permissions:

  • First number is for user
  • Second number is for group
  • Third number is for others

$ chmod 765 filename

In this example 7 is for user , 6 for group and 5 for others.

For example, give read, write ( 4+2 = 6 ) to user and read ( 4 ) to group and others.

$ chmod 644 filename

The table will help us to understand more about giving permissions.

          4        2           1

Read Write Execute

0       –            –          –

1       –            –          1

2       –            1         –

3       –            1        1

4       1            –         –

5       1            –         1

6       1            1         –

7       1            1         1

Umask

The umask acts as a set of permissions that applications cannot set on files. It’s a file mode creation mask for processes and cannot be set for directories itself. Most applications would not create files with execute permissions set, so they would have a default of 666, which is then modified by the umask.

Default file permission: 666

Default directory permission: 777

So if our umask value is 022, then any new files will, by default, have the permissions 644 (666 – 022). Likewise, any new directories will, by default, be created with the permissions 755 (777 – 022).

You can change the umask value to appropriate value of what you need based upon the above calculation. For example,

$ umask 077

Advertisements

Chmod Command for Beginners

There are two way to give file/directory permissions using bits and symbolic representation . In this article, let us discuss how to use symbolic representation with chmod.

we are having 3 different roles of symbolic representation user, group and others.The representation given below:

  • u is for user,
  • g is for group,
  • and o is for others.

we also have 3 symbolic representation of file/directory permissions. they are :

  • r is for read permission,
  • w is for write permission,
  • x is for execute permission.

And we also have +, – and = symbols :

  • + means Add,
  • – means Remove,
  • = means set the permissions exactly like this.

Following are few examples on how to use the symbolic representation on chmod.

1.Add a permission to file/directory

chmod g+w filename

Changing permission to a single set. + symbol means adding permission. Here we are giving group to write permission. Likewise you can give single permission(r/w/x) for any roles(u/g/o).

2. Remove permission from a file/directory

$ chmod u-x filename

This will remove execute permission from user.

3. Add multiple permission to a file/directory

Use comma to separate the multiple permission sets as shown below.

$ chmod u+r,g+x filename

4.Remove multiple permission from a file/directory

$ chmod u-rx filename

5. Change permission for all roles on a file/directory

$ chmod a+x filename

It will change the permission of all three roles such as user,group and others.

6. Set a permission of a file/directory

$ chmod u=w filename

7.Set multiple permission of a file/directory

$ chmod u=rwx filename

It will set the permission. This will replace the permission with given permission.

Installing Realtek rtl8723be driver for Ubuntu, Debian or Fedora

Originally written by  Chirath R

I have been searching for a fix for the wifi problems in my HP Pavillion ab-028tx. It’s having a Realtek rtl8723be Wifi Card. For a long time, there was no perfect driver for this device. I tried many drivers and none of them fixed the disconnection and low wifi range problems. At last, I found a fix from ubuntu forums. Follow these steps to get your wifi working in Ubuntu.

  • Get into your BIOS(in my case I had to press f10 after turning on my laptop). Then go into System Configuration->Boot options and Disable secure boot. This is very important as third party drivers won’t work in secure boot mode as they are not verified.
    • Save and restart(f10), open up a terminal (ctrl + alt + t) and type the following commands in order.
    • Installing new driver for the Realtek wifi chip.

    Note:  its suggested to have latest kernel installed(Linux kernel 4+).

    Step 1:

    Ubuntu :

    $ sudo add-apt-repository ppa:hanipouspilot/rtlwifi
    $ sudo apt-get update
    $ sudo apt-get install rtlwifi-new-dkms linux-firmware
    • Restart ubuntu.
    $ sudo reboot

    Debian:

    $  sudo apt-get install firmware-realtek

    Step 2:

    Common steps for all three OSes.

    • If you are not able to see your wifi networks, follow the steps below :
    • Download the driver by clicking “Download ZIP” from GitHub.(Note that the GitHub driver must be the master branch) or clone the driver by using the link https://github.com/lwfinger/rtlwifi_new.git
    • extract it to your home directory and open a terminal.
    • Execute the following commands :

    Step 3:

    Ubuntu and Debian

    $ sudo apt-get install linux-headers-$(uname -r) gcc g++ build-essential dkms git
    $ sudo reboot
    $ cd rtlwifi_new-rock.new_btcoex
    $ make
    $ sudo make install
    $ sudo modprobe -rv rtl8723be

    Fedora

    $ sudo dnf install kernel-devel kernel-headers
    $ cd rtlwifi_new-rock.new_btcoex
    $ make
    $ sudo make install
    $ sudo modprobe -rv rtl8723be

    Step 4:

    Common Steps

    • If you are unable to get wifi even now, change the antenna input to #2 using the command:
    $ sudo modprobe -v rtl8723be ant_sel=2
    • note : try changing ant-set=1 or 0 if it doesn’t work for u.
    • Now your Wifi will be working perfectly as in windows, now set input #2 as permanent.
    $ echo "options rtl8723be ant_sel=2 fwlps=0" | sudo tee /etc/modprobe.d/rtl8723be.conf

    And reload the module.

    $ sudo modprobe -r rtl8723be
    $ sudo modprobe rtl8723be

    Now your WiFi should be working perfectly 🙂 .