Tag: how-to

RAID1By Robert Camilleri

We start by listing the partition tables present on the server to locate the new hard disk

[root@mail ~]# fdisk -l

Disk /dev/hda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 1 13 104391 fd Linux raid autodetect
/dev/hda2 14 6387 51199155 fd Linux raid autodetect
/dev/hda3 6388 6769 3068415 fd Linux raid autodetect
/dev/hda4 6770 60801 434012040 fd Linux raid autodetect

Disk /dev/hdc: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/hdc doesn’t contain a valid partition table

Disk /dev/md1: 52.4 GB, 52427816960 bytes
2 heads, 4 sectors/track, 12799760 cylinders
Units = cylinders of 8 * 512 = 4096 bytes

Disk /dev/md1 doesn’t contain a valid partition table

Disk /dev/md3: 444.4 GB, 444428255232 bytes
2 heads, 4 sectors/track, 108502992 cylinders
Units = cylinders of 8 * 512 = 4096 bytes

Disk /dev/md3 doesn’t contain a valid partition table

Disk /dev/md2: 3141 MB, 3141926912 bytes
2 heads, 4 sectors/track, 767072 cylinders
Units = cylinders of 8 * 512 = 4096 bytes

Disk /dev/md2 doesn’t contain a valid partition table

Disk /dev/md0: 106 MB, 106823680 bytes
2 heads, 4 sectors/track, 26080 cylinders
Units = cylinders of 8 * 512 = 4096 bytes

Disk /dev/md0 doesn’t contain a valid partition table

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 1 121601 976760001 83 Linux
[root@mail ~]#

The above output shows that there are two hard disks (hda and hdc). Partitions are visible on hda however hdc does not contain a valid partition table. In fact this is the replacement for the faulty disk.

To view the health of the Software RAID type cat /proc/mdstat

[root@mail ~]# cat /proc/mdstat

Personalities: [raid1]

md0: active raid1 hda1[1]

104320 blocks [2/1] [_U]

md2: active raid1 hda3[1]
3068288 blocks [2/1] [_U]

md3: active raid1 hda4[1]
434011968 blocks [2/1] [_U]

md1: active raid1 hda2[1]
51199040 blocks [2/1] [_U]

unused devices:
[root@mail ~]#

Note that [2/1] shows that there are 2 disks in the array however only 1 is active. The symbols [_U] mean that one of the two disks is missing from the array and must be reconfigured.

Since the new disk is /dev/hdc we need create the partitions required for the RAID. Use fdisk to create the boot partition on the new disk.

[root@mail ~]# fdisk /dev/hdc

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel

Building a new DOS disklabel. Changes will remain in memory only,

until you decide to write them. After that, of course, the previous

content won't be recoverable.

The number of cylinders for this disk is set to 60801.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0×0000 of partition table 4 will be corrected by w(rite)

Command (m for help): p

Disk /dev/hdc: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-60801, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-60801, default 60801): +100M

Command (m for help): p

Disk /dev/hdc: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hdc1 1 13 104391 83 Linux

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): l

0 Empty 1e Hidden W95 FAT1 80 Old Minix be Solaris boot
1 FAT12 24 NEC DOS 81 Minix / old Lin bf Solaris
2 XENIX root 39 Plan 9 82 Linux swap / So c1 DRDOS/sec (FAT-
3 XENIX usr 3c PartitionMagic 83 Linux c4 DRDOS/sec (FAT-
4 FAT16 5 Extended 41 PPC PReP Boot 85 Linux extended c7 Syrinx
6 FAT16 42 SFS 86 NTFS volume set da Non-FS data
7 HPFS/NTFS 4d QNX4.x 87 NTFS volume set db CP/M / CTOS /.
8 AIX 4e QNX4.x 2nd part 88 Linux plaintext de Dell Utility
9 AIX bootable 4f QNX4.x 3rd part 8e Linux LVM df BootIt
a OS/2 Boot Manag 50 OnTrack DM 93 Amoeba e1 DOS access
b W95 FAT32 51 OnTrack DM6 Aux 94 Amoeba BBT e3 DOS R/O
c W95 FAT32 (LBA) 52 CP/M 9f BSD/OS e4 SpeedStor
e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a0 IBM Thinkpad hi eb BeOS fs
f W95 Ext’d (LBA) 54 OnTrackDM6 a5 FreeBSD ee EFI GPT
10 OPUS 55 EZ-Drive a6 OpenBSD ef EFI (FAT-12/16/
11 Hidden FAT12 56 Golden Bow a7 NeXTSTEP f0 Linux/PA-RISC b
12 Compaq diagnost 5c Priam Edisk a8 Darwin UFS f1 SpeedStor
14 Hidden FAT16 16 Hidden FAT16 63 GNU HURD or Sys ab Darwin boot f2 DOS secondary
17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fd Linux raid auto
18 AST SmartSleep 65 Novell Netware b8 BSDI swap fe LANstep
1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid ff BBT
1c Hidden W95 FAT3 75 PC/IX
Hex code (type L to list codes): fd
Changed system type of partition 1 to fd (Linux raid autodetect)

Command (m for help): p

Disk /dev/hdc: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hdc1 1 13 104391 fd Linux raid autodetect

Command (m for help):w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[root@mail ~]#

Type fdisk -l to verify creation of partition on the second disk

[root@mail ~]# fdisk -l

Disk /dev/hda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 1 13 104391 fd Linux raid autodetect
/dev/hda2 14 6387 51199155 fd Linux raid autodetect
/dev/hda3 6388 6769 3068415 fd Linux raid autodetect
/dev/hda4 6770 60801 434012040 fd Linux raid autodetect

Disk /dev/hdc: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hdc1 1 13 104391 fd Linux raid autodetect

Disk /dev/md1: 52.4 GB, 52427816960 bytes
2 heads, 4 sectors/track, 12799760 cylinders
Units = cylinders of 8 * 512 = 4096 bytes

Disk /dev/md1 doesn’t contain a valid partition table

Disk /dev/md3: 444.4 GB, 444428255232 bytes
2 heads, 4 sectors/track, 108502992 cylinders
Units = cylinders of 8 * 512 = 4096 bytes

Disk /dev/md3 doesn’t contain a valid partition table

Disk /dev/md2: 3141 MB, 3141926912 bytes
2 heads, 4 sectors/track, 767072 cylinders
Units = cylinders of 8 * 512 = 4096 bytes

Disk /dev/md2 doesn’t contain a valid partition table

Disk /dev/md0: 106 MB, 106823680 bytes
2 heads, 4 sectors/track, 26080 cylinders
Units = cylinders of 8 * 512 = 4096 bytes

Disk /dev/md0 doesn’t contain a valid partition table

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 1 121601 976760001 83 Linux
[root@mail ~]#

Software RAID requires disks in the array to be partitioned identically. You can try to do this manually calculating the exact number of cylinders required for each partition to match their counterparts on the other disk. This is highly discouraged. Instead we use the sfdisk command.

[root@mail ~]# sfdisk -d /dev/hda

# partition table of /dev/hda

unit: sectors

/dev/hda1: start= 63, 208782, Id=fd
/dev/hda2: start= 208845, Id=fd
/dev/hda3: start=102607155, 6136830, Id=fd
/dev/hda4: start=108743985, Id=fd
[root@mail ~]#

The output above displays the partition sizes on the primary disk

In order to create identical partitions on the secondary disk we type the following

[root@mail ~]# sfdisk -d /dev/hda | sfdisk /dev/hdc

Checking that no-one is using this disk right now... 

OK

Disk /dev/hdc: 60801 cylinders, 255 heads, 63 sectors/track
Old situation:
Units = cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0

Device Boot Start End #cyls #blocks Id System
/dev/hdc1 0+ 12 13- 104391 fd Linux raid autodetect
/dev/hdc2 0 – 0 0 0 Empty
/dev/hdc3 0 – 0 0 0 Empty
/dev/hdc4 0 – 0 0 0 Empty
New situation:
Units = sectors of 512 bytes, counting from 0

Device Boot Start End #sectors Id System
/dev/hdc1 63 208844 208782 fd Linux raid autodetect
/dev/hdc2 208845 102607154 102398310 fd Linux raid autodetect
/dev/hdc3 102607155 108743984 6136830 fd Linux raid autodetect
/dev/hdc4 108743985 976768064 868024080 fd Linux raid autodetect
Warning: no primary partition is marked bootable (active)
This does not matter for LILO, but the DOS MBR will not boot this disk.
Successfully wrote the new partition table

Re-reading the partition table…

If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)
to zero the first 512 bytes: dd if=/dev/zero of=/dev/foo7 bs=512 count=1
(See fdisk(8).)
[root@mail ~]#

Typing fdisk -l once again displays that the partitions on both disks are in fact identical

[root@mail ~]# fdisk -l

Disk /dev/hda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 1 13 104391 fd Linux raid autodetect
/dev/hda2 14 6387 51199155 fd Linux raid autodetect
/dev/hda3 6388 6769 3068415 fd Linux raid autodetect
/dev/hda4 6770 60801 434012040 fd Linux raid autodetect

Disk /dev/hdc: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hdc1 1 13 104391 fd Linux raid autodetect
/dev/hdc2 14 6387 51199155 fd Linux raid autodetect
/dev/hdc3 6388 6769 3068415 fd Linux raid autodetect
/dev/hdc4 6770 60801 434012040 fd Linux raid autodetect

Disk /dev/md1: 52.4 GB, 52427816960 bytes
2 heads, 4 sectors/track, 12799760 cylinders
Units = cylinders of 8 * 512 = 4096 bytes

Disk /dev/md1 doesn’t contain a valid partition table

Disk /dev/md3: 444.4 GB, 444428255232 bytes
2 heads, 4 sectors/track, 108502992 cylinders
Units = cylinders of 8 * 512 = 4096 bytes

Disk /dev/md3 doesn’t contain a valid partition table

Disk /dev/md2: 3141 MB, 3141926912 bytes
2 heads, 4 sectors/track, 767072 cylinders
Units = cylinders of 8 * 512 = 4096 bytes

Disk /dev/md2 doesn’t contain a valid partition table

Disk /dev/md0: 106 MB, 106823680 bytes
2 heads, 4 sectors/track, 26080 cylinders
Units = cylinders of 8 * 512 = 4096 bytes

Disk /dev/md0 doesn’t contain a valid partition table

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 1 121601 976760001 83 Linux
[root@mail ~]#

Now that the partitions are identical we can re-sync the information across the RAID configuration

Type mdadm -a /dev/md0 /dev/hdc1 to add /dev/hdc1 partition to the /dev/md0 RAID partition.

[root@mail ~]# mdadm -a /dev/md0 /dev/hdc1

mdadm: added /dev/hdc1

[root@mail ~]#

Type cat /proc/mdstat to view the re-syncing process

[root@mail ~]# cat /proc/mdstat

Personalities: [raid1]

md0: active raid1 hdc1[2] hda1[1]

104320 blocks [2/1] [_U]

[=>... ] recovery = 7.8% (8512/104320) finish=0.7min speed=2128K/sec

md2: active raid1 hda3[1]
3068288 blocks [2/1] [_U]

md3: active raid1 hda4[1]
434011968 blocks [2/1] [_U]

md1: active raid1 hda2[1]
51199040 blocks [2/1] [_U]

unused devices:
[root@mail ~]# cat /proc/mdstat
Personalities: [raid1]
md0: active raid1 hdc1[2] hda1[1]
104320 blocks [2/1] [_U]
[=======>... ] recovery = 37.2% (39808/104320) finish=0.5min speed=1809K/sec

md2: active raid1 hda3[1]
3068288 blocks [2/1] [_U]

md3: active raid1 hda4[1]
434011968 blocks [2/1] [_U]

md1: active raid1 hda2[1]
51199040 blocks [2/1] [_U]

unused devices:

The below shows how the output should be when the re-syncing process has ended. Note the “[UU]“. This confirms that both disks are active.

[root@mail ~]# cat /proc/mdstat

Personalities: [raid1]

md0: active raid1 hdc1[0] hda1[1]

104320 blocks [2/2] [UU]

md2: active raid1 hda3[1]
3068288 blocks [2/1] [_U]

md3: active raid1 hda4[1]
434011968 blocks [2/1] [_U]

md1: active raid1 hda2[1]
51199040 blocks [2/1] [_U]

unused devices:
[root@mail ~]#

The same process has to be performed on the other partitions

[root@mail ~]# mdadm -a /dev/md1 /dev/hdc2

mdadm: added /dev/hdc2

[root@mail ~]# mdadm -a /dev/md2 /dev/hdc3

mdadm: added /dev/hdc3

[root@mail ~]# mdadm -a /dev/md3 /dev/hdc4

mdadm: added /dev/hdc4

[root@mail ~]# cat /proc/mdstat

Personalities: [raid1]

md0: active raid1 hdc1[0] hda1[1]

104320 blocks [2/2] [UU]

md2: active raid1 hdc3[2] hda3[1]
3068288 blocks [2/1] [_U]
resync=DELAYED

md3: active raid1 hdc4[2] hda4[1]
434011968 blocks [2/1] [_U]
resync=DELAYED

md1: active raid1 hdc2[2] hda2[1]
51199040 blocks [2/1] [_U]
[>... ] recovery = 0.0% (37376/51199040) finish=501.5min speed=1698K/sec

unused devices:
[root@mail ~]#

Finally we need to install GRUB on the second disk’s MBR.

[root@mail ~]# grub
GNU GRUB version 0.97 (640K lower / 3072K upper memory)

[ Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename.]

grub> find /grub/grub.conf
(hd0,0)
(hd1,0)

grub> root (hd1,0)
Filesystem type is ext2fs, partition type 0xfd

grub> setup (hd1)
Checking if “/boot/grub/stage1″ exists… no
Checking if “/grub/stage1″ exists… yes
Checking if “/grub/stage2″ exists… yes
Checking if “/grub/e2fs_stage1_5″ exists… yes
Running “embed /grub/e2fs_stage1_5 (hd1)”… 15 sectors are embedded.
succeeded
Running “install /grub/stage1 (hd1) (hd1)1+15 p (hd1,0)/grub/stage2 /grub/grub.conf”… succeeded
Done.

grub> quit

Tags: , , , , ,

LAMP stands for: Linux Apache MySQL PHP. It is a popular way to get a professional style web hosting setup on one’s own computer. It’s quite simple to install and provides the major components of what is necessary to design and implement as simple or as complicated a website as one can imagine, just like having your own web hosting right on your own computer to experiment with!

The steps involved to getting a fully operational LAMP setup in Linux Mint 13 Maya are outlined below, complete with clickable screenshots.

Once again my system is as follows:

Intel Core 2 Duo 2.67GHz box with 2 GB of DDR2 RAM, Nvidia 8400GS card, running Linux Mint 13 Maya Xfce 64-bit.

STEP 1 – open a terminal and type sudo apt-get install lamp-server^
(note the carat “^” after server)

Press “Enter”

STEP 2 – Configuring mysql server – It’s always a good idea to change the default password whenever possible, make up a good one and don’t forget it!

…back to installing…

STEP 3 – Done with the terminal install for now

STEP 4 – Test the APACHE installation, open a browser window and type in the address: http://localhost/

Now test the PHP installation, for this we require a test PHP file in /var/www/ called test.php We can use a text editor as root, or as so often is the case we can type a command in the terminal: echo “<?php phpinfo(); ?>” | sudo tee /var/www/test.php

Once you do that, a restart of the Apache web server is required. That can be done by issuing this command: sudo service apache2 restart

After that is done, go back to the web browser and enter this address: http://localhost/test.php/ and you should see a page like this one describing your PHP installation:

STEP 5 – Fixing the Apache server qualified domain name error you may have seen in the terminal is easy enough at this point as well. Enter the following command in the terminal:

echo “ServerName localhost” | sudo tee /etc/apache2/conf.d/fqdn

Then restart the Apache server: sudo service apache2 reload

STEP 6 – Configure MySQL

It’s important to bind MySQL to your localhost IP address. Typically that IP address is 127.0.0.1, but we can verify that by issuing the following command:

cat /etc/hosts | grep localhost

In my case I saw this:

 

Next, verify you have the correct BIND address:

cat /etc/mysql/my.cnf | grep bind-address

In my case I have the proper 127.0.0.1:

STEP 7 – Installing PHPMyAdmin

The most convenient way to administer MySQL is by using this handy tool. As we’ve discovered so far, the process involved is quite easy. Back to the terminal we go, this time type: sudo apt-get install libapache2-mod-auth-mysql phpmyadmin

It will go through the familiar downloading process, then a screen will pop up asking which webserver to choose to be automatically configured to run PHPMyAdmin – Please choose Apache2 by pressing the space bar:

 

The next screen to pop up asks if you would like to use dbconfig-common to facilitate the use of PHPMyAdmin – as the screen shows, you should choose “Yes” unless you are an expert administrator.

 

Next, enter the MySQL password you entered earlier

Now, enter a password for PHPMyAdmin to register to the database server, then confirm on the next screen

STEP 8 – Testing PHPMyAdmin

Let’s make sure it’s working, type this address in your browser:

http://localhost/phpmyadmin

You should see this:

Now let’s login with root and the password we created earlier:

 Success! Congratulations, you have successfully installed Apache web server, MySQL, and PHP on your Linux Mint 13 machine. Hopefully the steps involved were straightforward and will reward you with years of fulfilling web development on your own computer.

 

Tags: , , , , , ,

By Clarence E Johnson

There are several ways to create a users and groups in Linux that are graphical, however the standard way to create a user is through the command line.

id command in terminalStep one is to create the group, then create the user and place the user in the group. In Linux when a user is created without specifying a group then a group is created by the same name as the user. Consider a system that has 100 users if each user was created without specifying a group then there will be 100 groups. You must be root in order to create users, groups, and users’ passwords.

# groupadd executive

Creates the executive group. To verify that a group was created view the /etc/group file.

# useradd -d /home/gbush -group executive gbush

Creates the directory /home/gbush, add the user gbush to the group executive group. To verify that the user was created view the /etc/passwd file. This file contains a record of all of the users on the system.

# passwd gbush

texan

texan

Creates a password for the user gbush as texan. The password of texan does not fit the necessary length and complexity, but as root you can change the password to anything you want.

# useradd -d /home/dcheney -group executive dcheney

Other useful commands are

userdel and groupdel for deleting users and groups.

usermod and groupmod for modifying users and groups.

Tip:

Considering the current political structure of this example (executive, legislative and judicial) can help you create groups, then add the appropriate users.

New Sessions

In Linux you can create login sessions by pressing Control+ALT and Function1 through Function6 keys. This is a good way to test the new user accounts.

Identity

Because it can be difficult knowing who you are logged in as you can type the following command

#id

This will tell you who you are and what groups you belong to.

You may also become another user by using the su command.

#su gbush

This command would allow you to become gbush. If you are not the root user then you will be asked for the password of gbush.

#su – gbush

The above command says that you want to become gbush and you would like to run his startup scripts and be placed in his home directory.

You may become a member of a different group by using the newgrp command.

#newgrp executive

Would place you in the executive group. Please note that if this is not your default group as noted in the /etc/passwd file, and you are not listed as a member in the /etc/group file then you will not be allowed to become a member of the group. As far as root is concerned, root can do anything at anytime.

HELP

Help can be obtained by using the manual command.

#man ls

Would give you the manual page of the ls command. This can be quite helpful if you forget an option to a command.

If you cannot remember a command but you know what it is similar to you can use the apropos command.

# apropos who

Would show you all of the command that have the word contain the world who.

The help command can be used to get help on some built in command.

#help logout

If you are concerned about where in the file system a command would be run from type in the following

#whereis rm

Would show you where in the system the rm command would be executed, if you were to type the command.

If you know part of the command but you would like to know where it exist on the system you can use the locate command which searches a database of file name that is maintained nightly.

#locate who

Would show you all of the files that have the word who in them. This search is done through out the system. This is good for user defined commands.

Commands

In order to configure the Linux computer for different services, you should have a good understanding of standard UNIX and TCP/IP commands. These are a few of the commands that are used in Linux:

ls

who

cat

pwd

cd

telnet

rlogin

ftp

rcp

traceroute

login

man

cp

bash

ln

passwd

rm

su

touch

startx

df

du

rsh

uptime

vi

pico

at

cron

more

find

rmdir

mkdir

ping

nslookup

This submission is made by Clarence E. Johnson, president of Johnson Computer Technologies Inc in St. Louis, MO. Please visit http://www.johnsonct.net for more info on Mr. Johnson.

Tags: , , , , , , ,

By Christopher P Wakefield

This time we are going to have a look at Linux permissions. Every current operating system deals with permissions, whether it is ownership of a file or just gaining read access to a folder. As with everything else in Linux there are command line tools and the graphical user interface so we shall discuss both.

chown --helpThe Chown Utility

This is a command line tool that deals with the ownership of a file or folder. Open up a terminal and switch to root. Navigate to the directory which contains the file / folder you want to change and type:

chown [username][file /folder]

So for example if I wanted to change the owner of a file called tools to natasha and it was located in /home/chris I would type:

cd /home/chris

chown natasha tools

To check who owns a particular file / folder you can navigate to the directory that contains the file / folder and type:

ls -l

The Chmod Utility

Next up is the chmod utility which deals with permissions themselves. Open up a terminal and switch to root. Navigate to the directory which contains the file / folder you want to change and type:

chmod [777][file / folder]

Lets first explain the numbering system above. There are three types of permissions in Linux – Read, Write and Execute which are given values of 4, 2 and 1 respectively. So in the syntax above the file would be given Read (4), Write (2) and Execute (1) permissions (4+2+1 = 7). But don’t you give permissions to people and not files or folders? Correct, that is why there are three numbers which represent the owner, group and others. Lets take an example to illustrate the point. Say I wanted to change the permissions of a file called tools.doc to owner (rwe), group (rw) and others (r) and it was located in /home/chris I would type:

cd /home/chris

chmod 764 tools.doc

This gives the owner (rwe = 7) group (rw = 6) and others (r=4) different levels of access to the file.

Graphical Means of Changing Permissions and Ownership

For people who don’t want to use the command line there is another way to do all this. I shall illustrate this using Linux Mint 9. Locate the file you want to alter by using your file manager. Right click and go to open as root. In Linux Mint 9 the background will go red when a file is open as root. Right click and go to properties. On the properties page you will be given the option of changing permissions for the owner, group and others along with changing the owner of the file. Change accordingly.

Hi I am Chris the owner of ComTech. I provide IT support to both personal and business clients from my base in Alloa, Clacknmannanshire. Here at ComTech I am experienced in using Windows, Linux and Cisco technologies whether it be for the home or business. I also incorporate Blackberry hardware into my business, namely the Blackberry Playbook and Bold 9780. I can advise, design and implement solutions to any problems you may have so if you have IT issues just pick up the phone. Please go to http://www.comtech247.net for more information.

Tags: , , , , ,

By Christopher P Wakefield

Linux MintToday we will have a look at setting up a DNS server on Linux. This tutorial was configured using Linux Mint 9 but the steps are the same for any Linux distribution.

First thing to do is to install the software we need. Open up a terminal and type:

sudo apt-get install bind9

Once installed it is time for some configuring. The first file we need to configure is named.conf.local. So in the terminal type:

sudo nano /etc/bind/named.conf.local

I have used nano to open up the file but use whichever text editor you are happy with. Insert the following code into the file:

# This is the zone definition. replace example.com with your domain name

zone “business.com” {

type master;

file “/etc/bind/zones/business.com.db”;

};

# This is the zone definition for reverse DNS. replace 0.168.192 with your network address in reverse notation – e.g my network address is 192.168.0

zone “1.168.192.in-addr.arpa” {

type master;

file “/etc/bind/zones/rev.0.168.192.in-addr.arpa”;

};

Replace business.com with the name of your DNS domain (this is not the same as an active directory domain but rather a name for your DNS zone).

Next up is the options file. In the terminal type:

sudo nano /etc/bind/named.conf.options

Within this file we need to modify the forwarder with the address of your ISP’s DNS servers. So modify the file adding the following:

forwarders {

194.72.0.114;

194.74.65.69;

};

Replace the addresses above with the addresses of your ISP’s DNS servers.

Now we need to add the zones file:

sudo mkdir /etc/bind/zones

And then configure it:

sudo nano /etc/bind/zones/business.com.db (replace business.com with your DNS domain).

Add the following code to the file:

// replace example.com with your domain name. do not forget the. after the domain name!

// Also, replace ns1 with the name of your DNS server

business.com. IN SOA chris-server.business.com.

// Do not modify the following lines!

2006081401

28800

3600

604800

38400

)

// Replace the following line as necessary:

// ns1 = DNS Server name

// mta = mail server name

// example.com = domain name

business.com. IN NS chris-server.business.com.

business.com. IN MX 10 mta.example.com.

// Replace the IP address with the right IP addresses.

www IN A 192.168.1.4

mta IN A 192.168.0.3

chris-server IN A 192.168.1.4

In the above code replace the following:

business.com with your DNS domain name,

192.168.1.4 with your static DNS server address,

chris-server.business.com with your computers hostname.dns-domain,

mta is your mail server (if you have one). If you do modify the IP address to show this.

Next we have to create the reverse DNS zone file:

sudo nano /etc/bind/zones/rev.1.168.192.in-addr.arpa

Add the following code:

//replace example.com with yoour domain name, ns1 with your DNS server name.

// The number before IN PTR example.com is the machine address of the DNS server

@ IN SOA chris-server.business.com admin.business.com. (

2006081401;

28800;

604800;

604800;

86400

)

IN NS chris-server.business.com.

1 IN PTR business.com

All that is left to do is restart bind:

sudo service bind9 restart (using upstart) or sudo /etc/init.d/bind9 restart (init scripts)

Don’t forget to test the new configuration:

dig business.com

Here at ComTech I love Linux. I use it for my own systems in the office and ‘pass on the good word’ to clients when appropriate. I can sort out any Linux queries you might have, including setting up servers, or offer advice if needed. Please go to http://www.comtech247.net/business-it for more information.

Tags: , , , , , , , ,

In this tutorial we will show how easy it is to enable Adobe Flash player to your Linux Mint 12 Live CD. As usual, please click each screenshot for a larger view.

Linux Mint 12 Live CD -no flash

Linux Mint 12 Live CD -no flash

First step is to boot up your Live Disc and open Firefox. This screenshot shows what will happen by default if you try to view content that relies on Adobe Flash to display.

 

 

 

 

 

Type mint-flashplugin-11 into Software Manager

Type mint-flashplugin-11 into Software Manager

Well, obviously that is going to severely limit the functionality of your Live CD, so the next step is install Flash the easiest way I’ve found. Click on Menu and choose the Software Manager (the yellow star). In the search box, type mint-flashplugin-11  then click on it in the list.

 

 

 

 

Click Install

Click Install

Once you’ve clicked on the mint-flashplugin-11 that appears in the list, you’ll see the next window that will have the Install button. Click Install and the Flash player will install to the Live CD environment.

 

 

 

 

 

Now, once it’s installed, close the Software Manager and reload Firefox. Voila! Your Youtube page you were trying to watch earlier is now working!

Linux Mint running Firefox with Flash installed

Linux Mint running Firefox with Flash installed

That’s really all there is to it. If you follow these steps you will find installing Flash much easier than trying to click the “Missing Plugins” button that first appears.

©2012 Linux.Bihlman.com

post written using Firefox on the Linux Mint 12 Live CD!

Tags: , , , , , , ,

Windows XP doesn’t come with a utility that allows you to see what files/folders are taking up the most room on your hard drive.  Don’t fret: sure there are programs out there you can download and install to do the job, but did you know you don’t have to actually install any software on Windows to actually find out what’s hogging all of your disk space? Well, it’s really easy as long as you have a Linux Live CD lying around. In this tutorial, we will be using Linux Mint 12 since it’s very popular right now in the tech world it’s currently leading the pack according to Distrowatch. Baobab, more commonly known as Disk Usage Analyzer, is part of gnome-utils and it is just an awesome graphical disk usage analyzer. You’ll find it on just about all Linux distros running the GNOME desktop environment.

Linux Mint screenshotStep 1:

Fire up your Linux Live CD running a GNOME desktop environment, in this example you will see we are using Linux Mint 12. Then, navigate to: Applications | Accessories | Disk Usage Analyzer

 

Disk Usage Analyzer

 

 

Step 2:

Here you will see Disk Usage Analyzer, and since we are in a Live environment, it defaults to the Live CD environment as shown on the right. Click on the green “Scan a folder” icon.

 

Choose filesystemStep 3:

Choose your hard drive listed on the left side. It will be the item that mostly likely has a size listed in GigaBytes – In this case it’s my 39 GB Filesystem. Then click Open in the bottom-right corner. If you have multiple hard drives they will be listed here as well.

 

Windows filesystem displayedStep 4:

After the filesystem is scanned, it displays the top folders on the left in list form, also graphically on the right side, showing color-coded comparisons of each folder. You can also view it as a treemap chart if you choose.

 

 

Hopefully this tutorial will give you some ideas on how even if you don’t use Linux as your daily operating system, you can take take advantage of some of the unique capabilities you gain by at least having a little Linux at your disposal!

© 2011 Linux.Bihlman.com

Tags: , , , , , , , ,

GNU-Linux Tools – Regular Expressions Basics

By Rand Whitehall

A regular expression, (also known as regexp or regex) helps us match a string of text. They can also match specific words, groups of words or characters.

Now, by themselves, regexps don’t do much. But combined with Linux search tools, they are very powerful. Here we’ll use the grep tool with regexps.

Now let’s take a look at an example. Say you wanted to find all the lines in a text file that started with the word “Joe” in a text file called bob.txt. You really can’t do this kind of thing with a typical GUI search tool. But with grep and regexp, it’s easy. Well, easy once you get the hang of it!

Our file bob.txt contains six lines:

Bob is a great guy

Unlike his buddy, Joe.

Bob likes to work.

Joe is a real bum.

Joe likes to watch other people work.

Jim is my hero.

James is not.

Here’s the grep command:

grep ‘^Joe ‘* bob.txt

Output:

Joe is a real bum.

Joe likes to watch other people work.

Notice how only the lines that start with Joe are printed?

The ‘^Joe’* part is the regular expression.

The ^ means start at the beginning of the line.

“Joe” means search for the word Joe.

The * is a wildcard meaning anything can come after Joe.

What if we wanted to match all lines in which the second letter is “o”?

In this case we need to use the. (period), which tells grep to search for any single character.

grep ‘^.o’ bob.txt

Output:

Bob is a great guy.

Bob likes to work.

Joe is a real bum.

Joe likes to watch other people work.

The [] brackets, are used to match a range of characters. For example, we could search for any lines that start with a “J” then any letter between a-m.

grep ‘^J[a-m]‘ bob.txt

Output:

Jim is my hero.

James is not.

Now, even though Jim starts with a “J”, it is excluded because the second character is not between a-m.

I hope this gets you more familiar using regexps. Please be aware that there are several versions of grep and some use slightly different regexp expressions. If you find a great regexp on the internet and it doesn’t work on your system, it may be because it’s not compatible with your particular version of grep. We’ve only touched the surface here, but I hope this gives some understanding of regexps and a hint at how powerful they can be.

Rand’s Adjustable Safety Razor website is a fantastic resource for old-school double-edge razor fans. Check out the Merkur safety razor page for info on Merkur’s adjustable safety razors.

Tags: , , , , , , , ,

By Clyde E. Boom

Linux Commands – The great thing about Linux commands is that they are virtually identical from one Linux distribution (version) to another. So the way the real pros do Linux administration is to work at the Linux command line and run Linux command lineLinux commands.

Learning how to run a Linux command can be very difficult for someone new to Linux, so here are some Linux tips that will help you to learn how to use Linux commands when working at the Linux command line prompt.

There are three main parts of a Linux command:

1. The Linux command name

2. Options that can be used with the Linux command

3. The “item(s)” that the Linux command is being run “on”

When you run a Linux command, spaces are used between: the Linux command name, the command options and the “item” the command is being run “on”. The “item” could be a Linux directory, file, user or some other Linux software component.

For example, you run the Linux command named ls (for list) “on” a Linux directory to see a list of files in the directory. You run the Linux command named rm (remove) “on” a Linux directory to remove the directory from the Linux file system.

To run a Linux command, you type in the name of the command, and any other parts of the command, such as options, and press the Enter key.

You can see an example of the Linux command that is used to create a new Linux user below. The useradd command is being run “on” the bthatcher user name to create this Linux user.

Linux Tips: Linux commands are run at the Linux command line prompt and this prompt is shown as ]# at the left of the command. You don’t type in the prompt, you type the Linux command at the right of the prompt.

Linux Tips: The Linux command prompt may also appear as: ]$ or as another symbol, instead of # or $.

]# useradd -c “Becky Thatcher” bthatcher

This Linux command creates a new Linux user named bthatcher with the full name of “Becky Thatcher”. The -c (for comment) option is used with this command to add the full name as a comment to the Linux user name of bthatcher.

One of the easiest and best ways to get Linux training is to see Linux commands being run in Linux video tutorials. With this method – you see, hear and do.

With a Linux video tutorial, you see and hear how to run a Linux command and see and hear a description of the output of the command. You can also pause the video so you can run the Linux command yourself!

Copyright ©  Clyde Boom

Clyde Boom, Author and Expert Trainer with 20+ Years of Training Successes. Explains intricate technical matters in an easy-to- understand, non-technical manner, with tens of thousands of software and hardware learners into masters.

You can watch Free Sample I Learn Linux Video Tutorials at http://www.iLearnLinux.com and get over the steep Linux learning curve.

Sign up for Free I Learn Linux News to receive technical tips, info on new video samples and important updates on Linux.

You need to learn Linux the easy way to get that new job, qualify for that next promotion, earn a hefty raise, get Linux certification, or keep your current job because your company is trying to save on software licensing fees (eza). Watch, do, and learn!

Tags: , , , , , , , , , , ,

How to Delete and Recover Files in Linux

By Luqmaan Ameen

Linux is a reasonably famous Operating System especially among programmers. The default file system in Linux is known to be intolerant when it comes to user mistakes, but using the method described in this post, you will be able to recover any data that you lost or accidentally deleted.

Deleting Files In Linux

Deleting a file in Linux is quite simple. You just have to right-click the file icon (which you want to delete) & then click the “Delete” option in the context menu. If you are working from the command console or terminal, the delete command is “rm” for remove. The “rm” command accepts a number of parameters which can be both unsafe and extraordinarily useful. The most famous parameter pair is “rm -rf”. This command deletes everything that’s present inside the specified folder, recursively (r). Moreover, this command does not ask you to confirm the deletion of each file. This means that you can accidentally delete the entire File system. This could be dangerous in some cases.

There is no recycle bin in Linux. So if you delete a file, It will no longer be available on your hard disk. Other operating systems however, usually have a recycle bin, which is just a folder where all the deleted files are preserved where they can be recovered or permanently deleted from there.

Recovering Files in Linux

Linux is famous for being customizable, there is a little tweak that can be made that will add the recycle bin functionality. You can simply add an alias to their.bashrc file, in a user’s home directory, that overrides the rm command. The alias is as follows:

alias rm=’mv –target-directory=$HOME/.Trash’

This alias would change the rm command into the mv, move command and send any files sent to be removed to the.Trash directory in the user’s home folder however this is not the best solution to save files from being lost as this may sometimes cause confusion with other aliases.

Another way of recovering files in linux is by using a process known as ‘File carving’. This application parses the hard disk for the leading and trailing bits of a file and then uses those bits to identify the file type and group together the deleted file on the disk. It is a reliable technique and is used by forensic data recovery.

You can use 3 main application for file carving: foremost, PhotoRec, and scalpel. From a console window, enter the application’s name, followed by the hard drive partition’s name found by using the “fdisk -l” command (ex. /dev/hda2).

Using the above two methods you should be able to recover or delete files in Linux in virtually any situation.

Luqmaan Ameen is the main writer behind Computer Realm, a blog which focuses on computer tips and several other aspects on computers and the internet in general. Cannot delete file? If so, you can find a free solution on http://www.computer-realm.net/cannot-delete-file/ on his site.

Tags: , ,
« Previous posts Back to top