Archive for November, 2009

Linux File Permissions

November 12, 2009 Leave a comment

I’ve allways struggled with how the linux permissions work. Recently i had another one of those times where i had to change a folders permission recursively so, once again, i googled it. The 5th result is a Google Code University Lab which actually explained it in a way i could get.

This post is a simple sumary of the lab.

When you do an ls -l on your console you will see something like the following

drwxr-xr-x. 2 sapiens sapiens 4096 2009-10-19 14:20 Desktop
drwxr-xr-x. 2 sapiens sapiens 4096 2009-10-07 23:55 Documents
-rwxr-xr-x. 3 sapiens sapiens 4096 2009-11-05 18:42 myStuff.txt

If you look at the start of the line you will notice a bunch of letters, they are actually 10 of them. At first when you are getting into linux these will seem like gibberish to you and you will basicly ignore them, but when you need to actually change the folders permissions you might want to try and learn how to read them.

The letters on that text means the following :

  • d – directory;
  • r – read granted;
  • w – write granted;
  • x – execute granted;
  • – Not granted.

Tha piece of text can be divided in 4 groups (1st group composed of the first caracther, then 3 groups of 3 characters each) :

  1. first letter states wether the file is a folder or not (if it has a ‘d’ its a directory);
  2. the next 3 letters states the permissions for the file Owner
  3. The next 3 letters states the permissions for the Group
  4. the last 3 letters states the permissions for Everyone

So you’ve learned how to read it, but how do you change it well basicly you will be using chmod for that (just man it). As for the arguments you can either write the whole text for the given file or use the short hand.The following table shows you how to use short hand version to give permissions:

Number Read (r) Write (w) Execute (x)
1 x
2 w
3 w x
4 r
5 r x
6 r w
7 r w x

Note: The above table was directly taken from the google lab, it also presents a good way to remember this table


In order to change a files permission you would write a 3 digit number, using the table above,  that defines the permissions for the groups mentioned above (owner, group, everyone else) for instance:

  • 644 would change a file/folder pemission to be read-only to everyone but the owner which would have full permissions
  • 755 (probably one of the most used) would make the file executable and readable to everyone and full permissions to the file owner.


External Links :


VirtualBox Share Folders with Guest Machine

November 2, 2009 1 comment

VirtualBox has a nifty feature that allows you to share folders with your guest machines. This will make a specific folder of you host machine avaible to your guest.

Though the menu option is clearly visible its actually hard to understand how this all works, especially if (like me :D) you are expecting it to magicly appear on your guest OS.

The initial sharing operation is as simple as can be :

  • Just jump to Shared folders menu option;
  • Add a new Folder (choose if its temporary or not);
  • Give the path to the folder and the share name.

Now the way you access this in your guest machine depends on the Operating System you are running. Mind that you will need to install the Guest Additions in order to share folders.

For windows guest the folder will be avaible automaticly but you will need to navigate to your network places and find “VirtualBox Shared Folders”. I had to go to Network Places -> Entire Network -> VirtualBox Shared Folders, and your share should be there.
For Linux Guest (works with Ubuntu and Fedora) you will need to mount the share in order for it to be acessible. So you will do the following :

  1. Create a directory where you wish to mount your share (let’s name it myshare);
  2. execute the command sudo mount.vboxsf MyShare /path/to/myshare.

Note that mount.vboxsf has no spaces. Above MyShare would be the name you gave your shared folder in the VirtualBox GUI. After that your share will be mounted on /path/to/myshare.

References :

Categories: Linux, Virtual Box Tags: , ,