Me in IT UNIX/Linux Consultancy is based in Breukelen, The Netherlands and specialized in UNIX and Linux consultancy. Experience with Red Hat Enterprise Linux (Red Hat Certified Architect), Fedora Project, CentOS, OpenBSD and related released Open Source products makes Me in IT UNIX/Linux Consultancy a great partner in implementing, maintaining and upgrading your environment.

Open Source software is an important aspect of any Linux distribution. Me in IT UNIX/Linux Consultancy tries to use Open Source software where possible and tries to share experiences actively. In the articles section you will find many UNIX/Linux adventures shared for others to benefit.

UNIX/Linux permissions on file/directories

I understand from non UNIX-ers that permissions can be challenging to understand. This article should get you going on any UNIX/Linux like operating system.

Each file (or directory) has a permissions based on identity:

  1. User this is the single person that owns the file.
  2. Group maybe users are part of a group.
  3. Other this is the rest of the world.

And each identity (user, group and other) can have a set of permissions. These can be expressed in more than one way; the whole word, the character representation of it or the numerical representation of it.

  1. Read or R or 4 the identity is allowed to read the file
  2. Write or W or 2 and now an identity is able to write to a file
  3. Execute or X or 1 makes identities being able to execute

Now that you know this, lets take a look at a listing of a few file, using ls(1) command: ls -l.

$ ls -l
total 16
drwxr-xr-x  2 robert users 4096 Dec 27 14:51 bin
-rwxr-x---  1 robert users 31 Feb 14 09:13
-rw-r--r--  1 robert users 13 Feb 14 09:12 textfile

The first column represent these permissions, the third and fourth column refer to user and group. So; the directory "bin" has these permissions: drwxr-xr-x Lets go over the individual characters:

  1. d This "thing" is a directory. For files it's a - sign.
  2. r This is the User part. The user has "read" permission.
  3. w The user has "write" permission. (Which means he can make new files inside this directory.)
  4. x The user has "execute" permission. (Which means he can change directory (cd(1)) into this directory.)
  5. r This is the group part, the group can read.
  6. - This is where "write" could have been. The group can't write in this directory.
  7. x The group has execute permission, the group is able to go into the directory.
  8. r This is the "other" (not user nor group) part. Everyone else can read.
  9. - Others can't write.
  10. x Others can execute/go into this directory.

You can repeat the same for those two other files. The difference is that and textfile are not directories, so:
Write means to have the ability to write in that file, aka modify.
Execute means the file can be executed, if there is code inside that actually does things, you are normally dealing with a program.

If you would express permissions with a number, you first split up the three parts, then count permissions for each part. For example:

  • rwx = 7 (r=4, w=2, x=1)
  • r-x = 5 (r=4, x=1)
  • r-- = 4 (r=4)

Some logical combinations are:

  • 777 everybody can do anything. (This can be dangerous!)
  • 750 user can do anything, group can't write, other can't do anything.
  • 640 user can read/write, group can read, others can't do anything.
  • 000 everybody can't do anything. (Except root) (This functionally locks files or directories)

Some strange combinations are 057, 077, 040, 007, etc.

Good, you are almost up to speed. One thing remaining; how to set or modify these permission. There are a few tools to help you:

  • chmod(1) Change (permission) modes for a file or directory.
  • chown(1) Change owner (and optionally group) of a file or directory.
  • chgrp(1) Change the group of a file or directory.

So, when you create a file, and would like to restrict a file to be only readable by the owner, you would use this command:

$ chmod 400 file

You could also use the more readable syntax of chmod(1):

$ chmod o-rwx,g-rwx,u-xw,u+r file

This tells chmod to (in order) remove (-) read write and execute (rwx) permissions for the others (o) of file. Then also remove all permission for the group, remove execute and write permissions and add read permissions to the user.

As using the human readable syntax for chmod requires more typing, it is almost better to use the numerical format. The only exception is when you only want to add on permission (like execute) without interfering with already existing permissions.

chown(1) is used change the owner of a file. It's rather straight forward:

$ chown robert:users

You can also remove that :users part to only change the owner of a file

chgrp(1) is even more straight forward, it changes the group of a file or directory:

$ chgrp users file

You have learned a major component of UNIX/Linux/*BSD operating systems. If you need more help, also see the man(1) pages of chmod(1), chown(1) and chgrp(1) by typing man chmod for example.

Open Source does not mean free

In my profession (UNIX/Linux and *BSD environments) Open Source is commonly used. My personal vision is that Open Source does not specifically imply free. Let's see what a randomly selected group of people answer to the question:

"Is Open Source software Free software?"

Person 0: No, for example Linux is not free; you are not free to do what you want.
Person 1: Open Source is not Free Software. Open Source is possibly free.
Person 2: Linux is financially free.
Person 3: Yes, Open Source software is free.

Wow, the answers are actually not what I expected. There is a difference in interpretation of Free. Lets take a look:

It seems that I was only thinking about the financial side of free and had forgotten about the functional aspects of free!

XML sitemap showing ugly URLS instead of URL paths in Drupal

If you see all the ugly URL's in your sitemap.xml, like /node/123, but have URL paths specified for those nodes, here is how to fix the problem:

  1. Deactivate "XML Sitemap Node" module. Your sitemap.xml will now not contain nodes anymore.
  2. Uninstall "XML Sitemap Node" module. This will remove all nodes from the sitemap.
  3. Activate "XML Sitemap Node" module. This will read all nodes and place them correctly into the sitemap.

It's that simple, but can make a huge difference, because you need to let search engines know how to access nodes based on your URL paths rather then the node number. Read more about SEO.

Making Linux commands shorter

Here are a few ways to shorten your Linux/UNIX/*BSD commands. Keep in mind that some short commands are less readable by others.

Long version Short version Characters won Application
cd $HOME cd 6 Shell
cat file | grep -v some | grep -v thing grep -vE 'some|thing' file 13 Shell
sort file | uniq sort -u file 4 Shell
:wq! :x 2 vi
boot bsd bsd 5 OpenBSD bootloader
grep -v '^#' file | grep -v '^$' grep -vE '^#|^$' file 11 Shell

Google Maps Mobile knows where I am (approximately)

This feature can change the mobile market, just as built-in camera's have, possibly more! If you download Google Maps for your mobile phone, you can use My Location. It does not use GPS but uses GSM antenna information to know where you are. This is not as accurate as GPS, and costs data, but if you have no GPS and have a data-plan, this is a cool feature. Take a look at this video:

Now what could be the next steps:

    Integrate with friends locations. Know where your friends are! Imagine being at a party, checking your phone to see if any other friends are there!

    Wardriving with only your mobile phone. If your phone supports WLAN, use it to scan access-points.

    Chatting to strangers nearby. Imagine a chat program that enables you to find people that have "Chat with anybody" set as a preference.

    Geocaching. GPS is more accurate, so this would require more descriptive hints, but it's possible!

Here in The Netherlands it tells me it is accurate within 1700 meters/1.1 mile, but the dot is acutally only 400 meters/0.25 miles away. I guess that mobile geographic application will dominate the future.

Using $GENERATE for PTR and A records

I was looking how to generate A records with the bind trick $GENERATE. There are lots of small articles available about setting up reversed lookups, but I could not easily find how to use this trick with A records. Therefore, here are my lines:

Forward or A record

$GENERATE 32-127 $ A 192.168.1.$

This will generate names like

Reverse or PTR record

$GENERATE 32-127 $ PTR $

This will generate the reverse part, it will enable you to do a host and get back the result.

5 ingredients for a good blog article

After reading many blogs and articles, I have discovered these basic ingredients keep me interested:

5. Short articles don't scare me away
Long articles make me loose interest when I see them. Shorter articles can be much more informative. I only take a minute, maybe 2 to read your article.

4. The essence keeps me interested
Some articles go into (not very interesting) details. This makes me loose interest too.

3. Structured articles help me
I want to be able to see the structure of the article/information within seconds. Using lists (<ol> and <ul>) and headings (<h2> or <h3>) helps.

2. Specialized topics interest me
I don't want to read news-paper style articles, otherwise, I would have bought a news paper. I am on the internet because I can read all these special articles.

1. The title should capture all information
I skim through websites only reading titles. Only if a title interest me, then I will stop scrolling and read that article.
A good example is the titles used at Boing Boing.

Help Network Solutions obtain idiotic domains

I was amused after reading this Network Solutions domain name registration story, I tried it for myself. Check out how easy it is to make Network Solutions pay another few Euros/Dollars:

1. Check if a domain is available

You can use online services, but whois from the command line like this:

$ whois

2. Check with Network Solutions

A stupid web-form on Network Solutions will say the domain is available for you to register. Meanwhile, Network Solutions has registered the domain.

3. Check whois again

As you can now see, Network Solutions has registered the domain. This process takes a few minutes only.

$ whois
   Whois Server:
   Referral URL:
   Status: clientHold
   Updated Date: 21-jan-2008
   Creation Date: 21-jan-2008
   Expiration Date: 21-jan-2009

The domain is in "clientHold" status for a year now. How rude is that? There will be many people shopping/browsing free domains using Network Solutions that are now only able to use Network Solutions to register their domain. (Or wait a year until it is free again...)

Registering a domain costs money, so I suggest you type in many idiotic domain names that nobody will ever be interested in. Some suggestions:

  • Combination of four or more words.
  • Words that are misspelled.
  • Words that do not exist.

How to waste time on the internet.

Have you ever wondered where you spend most of your online time? With the weekend coming up, here is a list of websites and activities that I do regularly.

  • Stumbling! This is a great way to discover new websites, read interesting stories that fit within your interest profile.
  • Reading news. Sites like Boing Boing, Tweakers (Dutch) and RSS feeds on Me in IT.
  • Reading email. I guess everybody does that. Switched to gmail recently, that reduced my time sorting and organizing.
  • Answering (and posing) silly questions. A great website when you have nothing else to do. Pose and answer questions that you have an opinion about.
  • Blog This is a great activity. Write about things that interest you!
  • Updating your contacts or profile on social networks. There are a few social networks that I frequently use: LinkedIn, Hyves (Dutch), Plaxo and Facebook.

Have fun but be sure to switch off the computer after a few hours, go and have a drink in the city, where your RL/physical friends are.

Linux in flight!

I was on the place, about to fly back from a great holiday in South Africa, when they had a problem with a transmitter on the aircraft. So, they had to "reboot" the whole aircraft. While this was happening I got a chance to see the entertainment system boot up. And, too my delight, I saw that it runs Linux!

About Consultancy Articles Contact

References Red Hat Certified Architect By Robert de Bock Robert de Bock
Curriculum Vitae By Fred Clausen +31 6 14 39 58 72
By Nelson Manning [email protected]
Syndicate content