Understanding the Linux permissions and chmod.

Hi folks, there are still a lot of people have quite a lot of trouble understanding the chmod command and it’s numbers.

Actually, that is not so difficult to get, so, now I’m going to teach you the basics of chmod, and it’s numbers.

First things first.

You must understand what Read, Write and Execute means. That’s crucial, so, first let me introduce you to some basics of Linux permissions.

  • Read – If you have permission to read something, that mean you can see what is inside a folder/directory, you can see a list of files and sub-directories.
  • Write – With the write permission you can change the content of a file, create new files inside folder, or create new folders.
  • Execute – This permission allows you to run software, you can run a program that is inside a folder or a binary that have permission to be run.

Now, you probably have heard about a magic thing like chmod 770 or chmod 777, haven’t you?

Let’s get back to the permissions, read, write, execute.

Each permission have a number:

  • Read = 4
  • Write = 2
  • Execute = 1

They have chosen this numbers because you can sum them in a way that you get different sum result for each sum.

For example:

  • 4 + 2 = 6
  • 4 + 2 + 1 = 7
  • 4 + 1 = 5

Did you get it yet?

  • 4 (read) + 2 (write) = 6 (Permission to read and write, but not execute)
  • 4 (read) + 2 (write) + 1 (execute) = 7 (Full permissions, you can read, write and run programs)
  • 4 (read) + 1 (execute) = 5 (You can read the content and run software, but can’t change or edit anything)

So, if a file named, let’s say, Stuff.bin, have the permission 7, then you can see it, edit it and run it.

But, the command is chmod 770, and I’m talking about only one number that is the result of a sum. So, now what?

Ok, we have a sequence of 3 numbers because they set permission for an user, a group and others

Again, user group others.

A group is a group of users, this way you can set permissions for more than one user!

  • chmod 777 means that the user can Read(4) + Write(2) + Execute(1), the users in a group can Read(4) + Write(2) + Execute(1) and everybody else can too Read(4) + Write(2) + Execute(1)!! So chmod 777 is NEVER a good idea!

I think that’s pretty much you need to know for now about chmod, let me show you some examples.

List folder content

megaf@DebianJessey:~/Examples$ ls
Executable.run Text.txt Whoa

Attempting to run “Executable.run”

megaf@DebianJessey:~/Examples$ ./Executable.run
bash: ./Executable.run: Permission denied

Changing permission so I can execute it then running it

megaf@DebianJessey:~/Examples$ chmod 770 Executable.run

megaf@DebianJessey:~/Examples$ ./Executable.run
Running this software

Showing what’s inside the file “Text.txt”

megaf@DebianJessey:~/Examples$ cat Text.txt
This is a text inside a text file

Changing permission so no one can see what inside it and trying to show what’s inside again

megaf@DebianJessey:~/Examples$ chmod 220 Text.txt
megaf@DebianJessey:~/Examples$ cat Text.txt
cat: Text.txt: Permission denied

Changing permission so I can edit the “Text.txt” file

megaf@DebianJessey:~/Examples$ chmod 660 Text.txt

Adding “Line2″ in a new line (Editing/Writing on “Text.txt”)

megaf@DebianJessey:~/Examples$ echo Line2 >> Text.txt

Let’s see the result

megaf@DebianJessey:~/Examples$ cat Text.txt
This is a text inside a text file
Line2

Changing permission so I can no longer change the file

megaf@DebianJessey:~/Examples$ chmod 440 Text.txt

Trying to edit it again

megaf@DebianJessey:~/Examples$ echo Line3 >> Text.txt
bash: Text.txt: Permission denied

 

Ok, Let’s move on, shall we?

That was the numeric way. There is another way.

From now on I will use only example an comment them.

megaf@DebianJessey:~/Examples$ ls -l ./ # Listing what’s inside this folder and it’s content permissions.
total 8
-rwxrwx— 1 megaf megaf 40 Jun 5 15:36 Executable.run
-r–r—– 1 megaf megaf 40 Jun 5 16:18 Text.txt
drwxr-xr-x 2 megaf megaf 6 Jun 5 15:37 Whoa

 

See those d, r, w, x, -? That’s even simpler than numbers.

- = Regular file, just a normal file.

d = Directory or folder.

So…

type user group others (I think these colors are colorblind people friendly)

- rwx rwx — means that the file have permissions [user] 7 (rwx) [group] 7 (rwx) [others] 0 (—)

- r– r– means that the file have permissions [user] 4 (r–) [group] 4 (r–) [others] 0 (—)

d rwx r-x r-x means that the directory have permissions [user] 7 (rwx) [group] 5 (r-x) [others] 5 (r-x)

 

Did you get it?

  • [r] 4 (read) + [r] 2 (write) = 6 (Permission to read and write, but not execute)
  • [r] 4 (read) + [r] 2 (write) + [x] 1 (execute) = 7 (Full permissions, you can read, write and run programs)
  • [r] 4 (read) + [x] 1 (execute) = 5 (You can read the content and run software, but can’t change or edit anything)

 

So, That’s all for now, questions/comments?

Opera 15 and a good and lightweight alternative to it

Hi folks, it’s not always that I’m writing something on this blog, but now I am.
So, this week Opera launched a new “beta” preview of what the WebKit Blink Based Opera 15 will look like.

Opera Next 15

A lot, really, a lot, of people are quite unhappy with that, not just because they are killing the long loved Presto, but because they are killing almost all the reasons that made people like me and like you, to use Opera in first place.

So, that’s the news about Opera…
Now I’m going to present you a good, cool, small, lightweight, fast, complete, open source, free, totally customizable, extensible true alternative to Opera!
I’t called Midori Browser.
Midori Browser is a WebKit based lightweight web browser that it is, well, what Opera used to be, I mean, powerful yet small and fast.
Now, let’s see some screenshots of Midori Browser running here on my desktop (Debian 8.0, GNU/Linux).

Preferences Windows What to do When Starting - Midori 0.5.0 - Customizations By Megaf - Debian 8.0

Menu - Midori 0.5.0 - Customizations By Megaf - Debian 8.0

File Transfers Sidebar - Midori 0.5.0 - Customizations By Megaf - Debian 8.0

RSS Feeds Plus WebKit Rendering - Midori 0.5.0 - Customizations By Megaf - Debian 8.0

SpeedDial - Midori 0.5.0 - Customizations By Megaf - Debian 8.0

Feeds Sidebar - Midori 0.5.0 - Customizations By Megaf - Debian 8.0

Extensions - Midori 0.5.0 - Customizations By Megaf - Debian 8.0

Bookmarks Folders - Midori 0.5.0 - Customizations By Megaf - Debian 8.0

As you can see, it’s a pretty good looking browser, and with true extensions you can add almost any feature you like.
As I’m writing this post, Midori lacks something like Notes and a integrated Mail client. Hey! If you are a developer you can easily make one yourself!

Bottom line is.
Opera, in the past Midori has learned a lot from you, now you can learn back a lot from Midori.
Users, if you are unhappy with Opera, there are good alternatives out there, just like I’m showing you now.
Hope you liked ii ;)

Mandriva 2011 Technology Preview

Hi all,
due to a huge number of big changes in Mandriva 2011 so far, combined with rpm5 migration both in the repositories and inside the build system, we have decided to shift the release dates for Mandriva 2011 by two weeks, to give us a better time period to fit the remaining pieces.

Therefore, the new release calendar for Mandriva 2011 will look like this:
- Mandriva 2011 Alpha: February 14 2011
- Mandriva 2011 Alpha 2: February 28 2011
- Mandriva 2011 Beta 1: March 14 2011
- Mandriva 2011 Beta 2: April 11 2011
- Mandriva 2011 RC: May 9 2011
- Mandriva 2011 Final: June 13 2011

However, as today’s date was promised to give you a preview on how Mandriva 2011 will look like, we have decided to prepare an additional release, calling it Mandriva 2011 Technology Preview, to show what is inside current Mandriva Cooker, and what will be available in Alpha. And this Technology Preview becomes available today .

The Technology Preview showcases what will be inside the first Mandriva 2011 Alpha version. It already comes with rpm5, native systemd, networkmanager support, KDE 4.6.0, kernel 2.6.37, firefox 4b10, X.org server 1.9, clementine 0.6 and lots of updated packages everywhere.

Also, this Technology Preview shows a preview of the the new way we are thinking on how to run and install Mandriva Desktop. It will be possible to use the same Mandriva image to run it live, from either cdrom and flash drives (you can use the Addons/livecd-iso-to-disk script from it, contained within the iso), or install it, all from the same image. So we will have the “Mandriva Desktop” image which will supersede both Mandriva Free and Mandriva One.

Of course, it comes with some missing pieces yet:
– Networkmanager daemon is not started automatically on boot. In order to use it, run the ‘systemctl start networkmanager.service’ after boot.
– Artwork is not updated to the latest version.
– And there are still many many bugs to fix.

But if you want to see the current way of things in Mandriva Cooker, and see an rpm5 and native-systemd-powered version of Mandriva, keep an eye on your favorite mirror – the isos should appear there shortly.


Eugeni Dodonov

Download now!
Mandriva 2011 TP i586 122.torrent

Mandriva 2011 TP x86_64 122.torrent

Mandriva – Installing and configuring a MySQL database server and an Apache web server with PHP support.

Hi, in this tutorial I’ll show to you how easy is to setup a LAMP web server with Mandriva Linux, just pay attention and do the steps carefully.

To make things crystal clear all the commands you have to use are in italic and the steps in bold.

Everything will be done using the root account, so open up a terminal and login as root.

Logging as system administrator

$ su

Type your root password.

First of all, you will download the apache web server, apache php module, MySQL Daemon and a tool to administrate you database, called PHPMyAdmin.

Installing all packages

# urpmi apache-mpm-prefork apache-mod_php mysql phpmyadmin –auto

If everything went right you have just downloaded and installed everything you need, if something went wrong or you have any question in this step, just ask in a comment!

In the following you are going to start the MySQL Daemon and then setup a password for the MySQL root user. This user and password you will user everything you login on the PHPMyAdmin panel to configure and administrate your databases.

Starting the MySQL Daemon

# /etc/init.d/mysqld restart

Creating a password for the MySQL root user

# /usr/bin/mysqladmin -u root password YOUR_NEW_PASSWORD

Ok, at this moment you are able to use and connect to your very own MySQL server!

Again, any error or question, just ask!

Now you will start the Apache Web Server and create a new MySQL user and database, using the phpmyadmin tool, it is really easy.

Starting up the apache web server

# /etc/init.d/httpd restart

You might get an error message here related to your hostname, you need to have a “qualified” host name, as “myserver” or “johnpc” or whatever but “localhost”. If you hostname is “localhost”, you have to change it, to do so, you can either use the drakconnect tool or drakhost. Any question, ask.

You are almost there, in the following you will finally create a new user and a new database.

Opening the phpmyadmin page

Open your browser and go to http://127.0.0.1/phpmyadmin

Go to “Privileges” Tab

Click on “Add a new User”

In “User name:” Put the username you want to use for you service/database, your database name will have the same name.

Write a new password at “Password:” and retype it. I can be the same password as above.

Now, in “Database for user” choose “Create database with same name and grant all privileges”.

And finally at “Global privileges” click on “Check all” and then on the button “Go”.

Further information:

Ok, at this point you have both Apache and MySQL up and running.

The database address you will use in you website, wordpress, media wiki or whatever will be localhost.

The username you created above is the username you will put on the username box.

Password on the password box and database name on the database box, did you get it?

Questions? Suggestions? Comment!

Did you like this tutorial? Download it in PDF!.

Introducing Skype4Mandriva

Hi folks, i have been improving Skype4Mandriva since Feb 2010, now the first stable release has arrived.

Skype4Mandriva, simple script made by me to download and install Skype on Mandriva systems. It will download the latest skype software and all those libs needed to run Skype properly. It works with all 32 and 64 bit Mandriva editions. From Mandriva 2008 Spring to the newest one.

Please test it and give your feedback!

Its easy to run!

1. open a terminal/console window.

2. download the latest Skype4Mandriva

wget http://dl.dropbox.com/u/2281263/Skype4Mandriva/Skype4Mandriva_latest_En.sh

3. log in as root

su

4. run Skype4Mandriva

sh  Skype4Mandriva_latest_En.sh

Fifth, Go to main menu > Internet > Skype and have fun!