File Permissions in Ubuntu

Ability to set file permissions for individual users or user-groups is one of the most sought after features of Linux. If you are system admin for a school, college or a company you work for then proper file permission setting is among the most vital tasks.

The command used to modify file permissions is chmod, short for change mode of a file. You can also use Nautilus file browser to change the file permissions. I will cover the details after a little background on the file permissions. To find the permission settings for a file, issue the following command int he terminal from the directory where your file is.

ls -l
cmd output

As you can see, the first column in the output has some strange looking character sets. This set is the file permissions for that file (directory). The third column is the owner of the file (directory) and the fourth column is the default group of the file (directory). We can ignore all the other columns at this point.

In the first column, each set would be 10 character wide. The very first character is a d for a directory or just a (hyphen) for files. After that, the next three characters are the permissions for the owners account. The order is read-write-execute. If the superuser can read the file it would display r otherwise just a . Similarly for write and execute w and x would be displayed. The next three characters are permissions for all the other users belonging to the file group (from the fourth column in the output above). Final three characters are the permissions for everyone not part of the group. Superusers (root accounts) can always override all the settings mentioned here and none of the permissions apply to them.

Changing Permissions – The Easy Way

The easiest way, as I said, is to just change the file permissions using Nautilus but it’s time consuming if you want to change the permissions of a lot of files. Command line way may seem tedious to begin with but it’s the faster way once you know your way around. To change the permissions in Nautilus, right click on any file (directory). Go to properties and then to permissions. Change the permissions and click ok. That’s it.

File Permissions

Changing Permissions – The Faster Way

To change file permissions via the terminal, you can use the chmod command. To change permissions of a file, enter the following command in the terminal.

chmod ABC path/to/file

Here, ABC is a 3 digit number which is the decimal representation of the file permissions. For example, r-x means 101 in binary which translates to 5 in decimal. So, if you want everyone to have just read and execute access to files and only the owner has the write access to files then the permissions are rwx,r-x,r-x which is 111,101,101. That translates to 7,5,5 (comma is only given for clarity here). So, the command would now be,

chmod 755 path/to/file

Don’t worry if you don’t know how binary works, you will get used to it. Easiest way is add 4 for read, 2 for write and 1 for execute. So, considering the examples above, rwx = 4 + 2 + 1 = 7 and r-x = 4 + 0 + 1 = 5. You’ll get used to this. There is another way to to this, the text method (which I don’t prefer).

chmod who=permissions filename

Where Who is any from a range of letters, and each signifies who you are going to give the permission to. They are as follows:

u – The user that own the file.
g – The group the file belongs to.
o – The other users i.e. everyone else.
a – all of the above – use this instead of having to type ugo.

And then you can directly write rwx in front of the equal sign. For example,

chmod g=rx

Next post will cover setting default permissions to files you create using umasks.

Category: Linux | Comments Off on File Permissions in Ubuntu

Setting Up WiFi Connection Using WiCD

WiCD Logo

Often times Linux users find themselves wanting more from the network manager, especially laptop users on the move find it difficult to manage all the different networks they have access to. WiCD is one of the best tools for people wanting more. It’s gtk based network configuration tool, especially meant for wireless networks written in python. Apart from being dependent on gtk, it does not require any of gnome components to work. Rejoice all the openbox and fluxbox users.

Here’s what WiCD can do (taken from the official documentation),

Compatible with standard *nix networking commands (iwconfig, ifconfig, etc)
Once configured, will connect even if the X display does not start
Can be managed and configured via the command line using wicd-curses
Support for wired networks, as well as named profiles to save multiple wired configurations.
Supports configuring static IP addresses and DHCP on a per network basis
Store different static IPs, gateways, subnet masks, DNS server addresses per network
Automatically connect at boot – no user intervention required, even for encrypted networks
Keeps network keys in root accesible only (600) files (unencrypted, however)
Encryption (template based)

WPA 1/2

Automatically connects at resume from suspend
Displays information about the network
Ability to run scripts before/after connecting/disconnecting

All this and it’s really easy to use. Let’s start by installing WiCD, if you are an Ubuntu user, you can install WiCD very easily. All you need to do is open a terminal and issue following command,

sudo apt-get install wicd

This will install both WiCD with all the required dependencies. It will then ask you for the users you want to configure WiCD for. WiCD also comes with a tray icon. You can add it by right clicking a panel and choosing add to panel option then choose custom application launcher. Give it any name you want and in the command box type,


and you will have a tray icon now. Open WiCD and you will be greeted with a screen showing all the wireless networks in the range. You can then chose to connect to any network you want. If the network is protected by any security then you would have to chose the method of security in place and enter the correct key to connect to the network.

WiCD Networks

WiCD Networks

You, of course, also get the option to chose whether to use DHCP or static IPs, which DNS you want to use, which secondary DNS you want to use. gateways, subnet masks. You can also use it to manage wired networks.

WiCD Advanced

WiCD Advanced

And there’s more…

WiCD Advanced 2.0

WiCD Advanced 2.0

I for one have never had any problems with WiCD., although there are people who report certain incidents, it’s free from most major bugs and is a very solid program. One of my favourite distributions, Zenwalk, comes with WiCD pre-installed. Rest assured, this is a great tool to manage all your moving connection needs.

Category: Linux | Comments Off on Setting Up WiFi Connection Using WiCD