Begin Linux Blog

Linux Distro Releases and News

Archive for August, 2008

Fedora 9 Video – Installing a New Theme

Posted by beginlinux on August 28, 2008

Installing a new theme on your Linux desktop can bring your system uniqueness, make it easier to see, or maybe boost your productivity. Whatever your reason it seems like a lot of people have found downloading and installing themes from the internet the easiest way to get apply new themes. Most distribution offer at least a few decent themes that you can switch in and out but nothing compares to the constant growing on-line supply of Linux desktop themes.

I’ve created a step-by-step video walk-through with voice over describing the theme installation process on the Fedora 9 Gnome desktop.
View the video and complete story

Posted in Desktop User | Tagged: , , | Leave a Comment »

Locating Information from the Command Line

Posted by beginlinux on August 19, 2008

Specific searches for information can provide excellent resources for troubleshooting. This section will help you examine a number of ways to find the information that you need.

Search Packages

When Ubuntu updates packages it keeps a package cache of .deb files in /var/cache/apt/archives. This archive can be used to review recent changes on your server. Here are a series of examples to help with searching packages.

Search packages added in last week

find /var/cache/apt/archives -iname ‘*.deb’ -atime -7

Note that atime is used because packages in this directory are not modified they are only added.

Search for packages which have a specific name
Be sure to use the “-n” option as it will force the search to be used for file that have the text string, in this example “apache”, in the name. Otherwise it will include those who have that text string in the description.

apt-cache search -n apache

This search will provide very helpful information for what packages were changed on an update. The “reverse depends” list shows packages which require, recommend or suggest the package searched. The “dependencies” list shows which packages are required, recommended, or suggested for your searched package.

Search for Sizes

Find all files over 10 MB
find / -size +10000000c 2> /dev/null

Find all files over 50 MB
find / -size +50000000c 2> /dev/null

The “2> /dev/null” sends all error messages to the trash instead of the screen.

Search User Owned Files

If you want to find files that belong to only a certain user, you can do that with the “-user” switch. Add a second criterion to find only files of a certain type that belong to a certain user.

find / -user tom -iname ‘*.txt’

You can adjust this search by changing the text string which represents the file type. In the example, “.txt” is used but that could be changed to and file type, like; “.rtf”,”.conf”,”.jpg”,”.gif”, etc.

Managing Versions
Using the “-v” option you can show the version of many programs to verify which version is current. Here are a few examples.

apache2 -v
Server version: Apache/2.2.8 (Ubuntu)
Server built: Jun 25 2008 13:54:13

syslogd -v
syslogd 1.5.0


Using Aptitude to Locate Information

Aptitude is a text mode tool with a menu front end for apt. It can easily provide information about packages and the versions that you currently have installed as well as packages that are not installed. You can access aptitude with:

sudo aptitude

When you open aptitude you will see a menu bar at the top of the screen with two panes below the menu bar. The top pane lists package categories and the bottom pane contains information related to the packages and package categories that you select.

Caution: You can easily break your system using aptitude carelessly as you will be running as root and you can easily install or uninstall packages.

— Installed Packages
— Not Installed Packages
— Obsolete and Locally Create Packages
— Virtual Packages (do not exist but the names are required by other programs)
— Tasks (select packages by groups)

Select any of the five categories and it will expand to show groups related to software packages. For example if you select Installed Packages you will see a list of categories that starts like this:

— admin
— main (Fully supported software)
I grub 0.97-29ubu
— universe (Unsupported software)
— base
—comm

Select a specific category and you will see the individual repository that the packages come from. When you select a repository you will see a list of applications followed by the version that is used. If you see an “I” it indicates that it is installed on the system. In the bottom pane you will see a description of the package.

Whenever you list packages they will have one of these indicators in front of the package to indicate the status of the package.

i: Installed package
c: Package not installed, but package configuration remains on system
p: Purged from system
v: Virtual package -
B: Broken package
u: Unpacked files, but package not yet configured
C: Half-configured – Configuration failed and requires fix
H: Half-installed – Removal failed and requires fix

You can use the F10 key to access the menu across the top.

Actions Undo Package Resolver Search Options Views Help

Actions – install and uninstall options, clean cache
Undo – undo actions

Package – manage install, remove, purge, etc of packages
Resolver – try to resolve issues with conflicts
Find – locate packages
Options – display options
Views – quick access to various view options
Help – basic help

Using dpkg to Locate Information

The dpkg or Debian Package Management tool is an additional way to locate information about packages. If you use the “-l” option you can provide a topic and it will list the package version that is installed.

dpkg -l apache2
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-f/Unpacked/Failed-cfg/Half-inst/t-aWait/T-pend
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name Version Description
+++-====================-====================-
ii apache2 2.2.8-1ubuntu0.3 Next generation, scalable, extendable web server

dpkg -l cron
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-f/Unpacked/Failed-cfg/Half-inst/t-aWait/T-pend
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name Version Description
+++-====================-====================-
ii cron 3.0pl1-100ubuntu2 management of regular background processing

If you want to list all packages installed use “-l” alone. It will list the package name, version and brief description.

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-f/Unpacked/Failed-cfg/Half-inst/t-aWait/T-pend
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name Version Description
+++-==========================================

ii acl 2.2.45-1 Access control li
st utilities
ii acpi 0.09-3ubuntu1 displays information on ACPI devices
ii acpi-support 0.109 a collection of useful events for acpi
ii acpid 1.0.4-5ubuntu9 Utilities for using ACPI power management
ii adduser 3.105ubuntu1 add and remove users and groups

Posted in Uncategorized | Tagged: , , , , | Leave a Comment »

Red Flag Linux 7.0 Preview (Olympic Edition)

Posted by beginlinux on August 15, 2008


Since its founding on June 2000, Red Flag Software, has become China’s top Linux company controlling 80% of the Chinese Linux desktop market in 2006. With Red Flag Software located in the heart of Beijing, and two subsidiaries in Guangzhou and Shanghai, Red Flag Linux is promoted through efficient, well-established sales channels deployed all over China.

Red Flag Linux is now releasing “Olympic” which serves as preview of the stable release of Red Flag Linux 7.0. The OS features an installable live CD that brings a reworked KDE 4.1 desktop complete with an Olympic theme. Other features include things like a beta migration wizard, the Linux kernel 2.6.25, glibc 2.8, GCC 4.3.1, xorg-server 1.4.99, Qt 4.4.0, Firefox 3.0 for web browsing and Wine 1.0 for windows applications. The Red Flag Linux supports English and both traditional and simplified Chinese. Visit the English version of the Red Flag Linux website.

Posted in Desktop User | Tagged: , | 1 Comment »

Beginners Guide to Command Line Part III

Posted by beginlinux on August 12, 2008

How to Acquire root Privileges
There are several ways to escalate the normal user privileges to the root user privileges. You may wonder why this needs to be done. There are many files and directories that cannot be modified by the normal user. If you are trying to fix problems and sometimes when you are trying locate problems you will need the privileges of root.

The su command allows you to “substitute user”. One of the major disadvantages of this process is that su does not record the commands executed as root. It does create a log entry for which user became root and when but not what they did with the power! Once logged in as a user you can switch to root with this command:
su root

The system will then ask for the root password. This will then provide the user with full control of the entire system and access to all files and directories on the system. One item of note for Ubuntu users. If the root account has not been configured to enable this feature you will not be able to become root with su.

su – root

This is an additional option that will place you in the root home directory when executed and provide you with the environment of the root users as well. Details of the root user environment will be discussed in the path explanation.

sudo
When Ubuntu is installed the first user to be installed on the system will be able use the sudo su command to administer the system. This is because the first user is placed in groups that allow these special privileges. Subsequent users that are added do not get these privileges by default. You can see in the example below that the first user mike is placed in a number of special groups providing these privileges while the users tom and diane do not have the same rights. This can be viewed when you open the /etc/group file with cat, short for catenate.

cat /etc/group

adm:x:4:mike
tty:x:5:
dialout:x:20:mike
cdrom:x:24:mike,tom
floppy:x:25:mike
audio:x:29:pulse,mike,tom
dip:x:30:mike
video:x:44:mike,tom
plugdev:x:46:mike,tom
fuse:x:107:mike
lpadmin:x:109:mike
admin:x:115:mike
pulse:x:116:mike
–cut–
mike:x:1000:
tom:x:1001:
diane:x:1002:

The advantage of using sudo is that there is better command logging for accountability, you can limit access, you do not have to reveal the root password, and sudo is faster

How to use the sudo command
The first user created on the system, because they are added to special groups, has the privileges to run administrative commands even though they are a normal user. If mike a normal user wanted to check the firewall configuration and executed the command, iptables -L, would only see a response that they did not have the correct privileges as you can see below.

mike@ub:/etc$ iptables -L
iptables v1.3.8: can’t initialize iptables table `filter’: Permission denied (you must be root)
Perhaps iptables or your kernel needs to be upgraded.

Now if mike was a normal user that had been placed in the privileged groups he could use the sudo command to be able to execute that command. The sudo command precedes the command you want to run with root privileges.

Format → sudo command options

In the example below sudo precedes the command iptables which is followed by the option -L.

mike@ub:/etc$ sudo iptables -L
[sudo] password for mike:
Chain INPUT (policy DROP)
target prot opt source destination
ufw-before-input all — anywhere anywhere
ufw-after-input all — anywhere anywhere
—cut—

In Ubuntu the sudo command can be joined with su to create the privileges needed to execute administrative commands and to change users to root as long as you remained logged in.

sudo su

This will mean that the user will receive root privileges and be actually running as the root user which will be reflected in the prompt as you see below. Note that the “$” on the end which signifies a normal user has been replaced by the “#” which indicates that the user is now functioning as root in all of the commands they execute.

root@ub:/etc#

This is a dangerous thing to do because any mistake you make will be a permanent change, which no warning.

Posted in Uncategorized | Tagged: , , , | Leave a Comment »

Beginner’s Guide to Command Line: Part II

Posted by beginlinux on August 9, 2008

Understanding Users

Who you are as a user on the Linux system is important to understanding what you can do. Just like Windows, Linux is a multi-user operating system and all users do not possess the same rights. There are three basic types of users on the Linux system; the root user, normal user accounts and the service users.

The root user account is created by the operating system when it is installed. This user is the superuser who basically has complete control of the entire system. This means that great care should be taken to preserve the integrity of this account. One aspect of this care is to ensure that the root password is complex and changed on a regular basis. In addition, the root account should not be used to log into a server because if anyone gains access to the root account they have complete control of all services and information located on the server.
Service accounts such as apache, squid, cups, etc. are each created when the service is installed. Typically there is no need to change these accounts. These accounts often are accounts that cannot be used to log into the server. A number of service accounts cannot be used to log into the system. This is simply a security matter and should not be changed nor will it offer any problems.
Normal users are users that are created on Linux file system and have a home directory in /home. So if you had 4 users on the system called; fred, jane, mary and tom you would see these /home directories.

/home
/fred
/jane
/mary
/tom
Normal Users
Normal users do not all have the same privileges. The fist user created on the system can use a special command called “sudo” to gain root privileges so that this account could be used to manage a server or desktop. Other users do not by default have these rights nor can they gain these rights unless the root user provides them with those special rights.

Typically users can do anything they want in their own home directories. They can create, copy or delete files and directories in their home. They also have the rights to read just about any file on the entire Linux system. That means that they can read any of the configuration files in the /etc directory or any of the program listings in the /usr directory. Normal users can move all around the file system. There are very few limitations, one of those is the /root directory. No user is allowed to view or move into the /root directory which is the home directory for the root user.
The implications of a normal user in the file system is that they can only save files or backups to their own home directory, they will not be able to save anywhere else.

When users are created they will also be created as a member of a group with the same name. So when the user tom is created, immediately the group tom is created with the user tom being the only member. Groups allow several users to share files if they needed to. Here are a few examples.
User Group
tom tom
jane jane
mary mary
fred fred, tom, mary
In the examples above, each user is created and the group with their name is also created. However, when you look at the group fred both tom and mary have been added to that group so that fred, tom and mary could share files that were owned by the group.
A user’s login name must be unique and less than 32 characters. It may contain any characters except colons and new lines. Typically login names are lower case, some Linux distros require lower case. When you create login names a standard is important as these names also reflect what will be available for email addresses.
User passwords are encrypted and kept in a separate file which is not available to anyone but root. This file is /etc/shadow. Passwords must be encrypted which means they must be created with the passwd command or encrypted and copied to the account. However, editing accounts by hand is filled with possibilities of mistakes so should be avoided. Most Linux distributions use the MD5 encryption which allows for random lengths in passwords.
When users are create d they will get a login name for the users to recognize but the system will user a UID or User Identification number. These numbers will begin at either 500 or 1000 and be incremented by one for each new user. So if you create the user tom and tom is the first user to be created he will have a UID of 1001.
tom 1001
mary 1002
jane 1003
fred 1004

In addition to UIDs that are created, a GID or Group Identification number is also created for each user name. The GID is a private group with Ubuntu which means that no other users have read access to a user’s files. If tom is the first created user and his UID is 1001 he will also have a GID of 1001. Again, the numbers that relate to the users is for the operating system. Here are some examples.
User UID GID
tom 1001 1001
mary 1002 1002
jane 1003 1003
fred 1004 1005
Note that the UID and the GID do not have to be the same. If you created a special group before you created fred then all the rest of the numbers will be out of sync which is not a problem but something you need to be aware of.

The root User

The root user is the superuser on the system. Root has access to all files and directories on the system and is able to configure all aspects of the system. The UID for root is 0, which you can see in /etc/passwd. There should only be one user with a UID of 0 on the system as this could lead to serious security abuse. Many activities on the system are limited to the root user only. Changes like creating device files, setting the hostname, configuring network interfaces, working with privileged network ports (below 1024) are examples of activities that can only be performed by root. This is a powerful and yet dangerous account as root can make, and will make mistakes that could take the system down.

root Login
Best security practices suggest that you never login as root. When you login as the administrator of the Linux system you need to recognize the dangers of allowing the server to run as root. Any access gained into the system as root user will give intruders complete control of the server. If you login as a normal user this means that you must become root using the “su root” command. This is simply to protect your system when online since if the system was cracked when you are logged in as a regular user there is much less damage done than if you were logged in as root, allowing full access. The issue is file and directory ownership and access. User Identification numbers (UID) and Group Identification numbers are mapped to each user and group and recorded in /etc/passwd and /etc/group. These UIDs and GIDs are used to determine ownership and access to files and directories. In addition, users run processes and the owner of a process can send process signals that can impact the process activity.

The root user is intended to run many commands that are not available to other users of the operating system. Here are several directories that are intended only for the root user:
/sbin – This directory contains commands for modifying disk partitions (fdisk), changing boot procedures (lilo), and changing system states (init).
/usr/sbin – This directory has commands for managing user accounts (adduser), configuring the mouse(mouseconfig) or keyboard (kbdconfig). Most daemon processes are also in this directory.
/bin and /usr/bin contain commands that both root and users will use. For example: /bin/mount is a command that root will mount directories but users will use this command to list mounted directories.
The /usr/share/man/man8 directory lists many of the commands that are intended for use by the system administrator.

Posted in Uncategorized | Tagged: , | Leave a Comment »