Showing posts with label System Administration. Show all posts
Showing posts with label System Administration. Show all posts

PackageKit

PackageKit is a system designed to make installing and updating software on your computer easier. The primary design goal is to unify all the software graphical tools used in different distributions, and use some of the latest technology like PolicyKit to make the process suck less.

For more information on PackageKit

Commands to find out who are logged on

Simple but useful command to know who logged on to your systems

Tool 1: w - Show who is logged on and what they are doing
# w

Tool 2: who - Show who is logged on
# who
# who -q (All login name and count number of user logged on)

Tool 3: last - show listing of last logged in users
# last

Tool 4: uptime - Tell how long the system has been running
# uptime

Using Gnome Partition Editor (Gparted) to resize, move the partition Windows NTFS

GParted is a free partition editor for graphically managing your disk partitions. The latest stable version of GParted is able to handle comfortably the following file systems. See Gpart -- Features. Please check before you use Gparted.

I have used the Gparted to shrink my D drive, and expand the "C" Drive on a Windows 7. I was pleasantly surprised that after dhrinking my D drive, I can move "D" Drive to the "free space" and  create "free" space on the right of the C Drive. And all this is done with simple clicked, drag and drop.

Indeed a wonderful tool for System Administration

NFS and "Permission Denied" Mount Problem at the Client

I've encountered a strange issue with the NFS mount today.

1. On the LINUX Client
# mount /nfs-server
mount: xxx.xxx.xxx.xxx:/nfs-server failed,
reason given by server: Permission denied

We have checked the permission on the nfs-server:/etc/exports and everything is correct. We did a:

# showmount -e nfs-server
Everything was correct too and seem correct. If we do a "rpcinfo -p", it also show correct information
program vers proto port
100000 2 tcp 111 portmapper
100000 2 udp 111 portmapper
100024 1 udp 615 status
100024 1 tcp 618 status
100021 1 udp 32771 nlockmgr
100021 3 udp 32771 nlockmgr
100021 4 udp 32771 nlockmgr
100021 1 tcp 37569 nlockmgr
100021 3 tcp 37569 nlockmgr
100021 4 tcp 37569 nlockmgr

On the Server side,
We check the /etc/exports and everything is correct. Next we restarted the NFS and the Portmap Services. But the Clients still show the "Permission Denied" Error

We noticed that the /proc/mounts/ did not have the NFS Information. To resolve this issues, we have to manually add NFS information inside the /proc/mounts
nfs-server:/home /home nfs rw,vers=3,rsize=8192,wsize=8192,hard,intr,proto=tcp,timeo=14,retrans=2,sec=sys,addr=n00 0 0

We did the NFS Mount and everything was working!


Related Articles:

Power Mangement for KDE and Gnome



Gnome Power Mangement is a essential tool for power mangement on notebook and desktop. It has interesting options such as
  1. To suspend your laptop when the lid is closed.
  2. Power History (my favourite)
  3. Display Brightness
  4. Actions taken when power buttons or suspend buttons is pressed
  5. And so much more.....
It comes with Installation....of Linux Mint and Ubuntu



KDE Power Devil is a lightweight laptop power management system designed for KDE4 Environment. According to the site, with PowerDevil you can set up preferences for lid Closing, Brightness, CPU scaling, Idle time, both when connected to AC and when on Battery.

Good news! KDE Power Devil is now compiled with KDE Core Releases and no longer as an external application

Disabling Shutdown and Reboot in GNOME logout menu

For workstations that have to be shared among different users, there are some steps Administrators can do to prevent users from rebooting or shutdown


1. Changing GNOME System Menu

Change the gdm's config file
# vim /etc/X11/gdm/gdm.conf

Find a line in the gdm.conf
# SystemMenu = false

2. To Prevent users from opening a termina and running "poweroff" or "reboot"
Delete or move these files:
/etc/security/console.apps/poweroff
/etc/security/console.apps/reboot

3. Prevent shutdown using Alt-Ctrl-Del
# vim inittab

# Trap CTRL-ALT-DELETE
ca::ctrlaltdel:/sbin/shutdown -t3 -r now

And change it to read:
# Disallow CTRL-ALT-DELETE
ca::ctrlaltdel:/bin/echo "ctrl-alt-delete has been disabled"

Modify the ownership
#sudo chgrp root /sbin/halt /sbin/shutdown
#sudo chmod 550 /sbin/halt /sbin/shutdown

Articles:

  1. Disable Shutdown For Normal Users (Ubuntu Blog)
  2. Disable shutdown/reboot in GNOME logout menu (Fedora Mailing List)

Centrify Express Express Tips and Tricks


Centrify Express provides a couple of good links to provide some quick-start to configure Linux Box to talk to the MS AD
  1. For Best Practise Video, see Centrify Express Tips and Tricks
  2. For the  community site including forum see Centrify Express Community Site

dmidecode - Finding the hardware details remotely

dmidecode is a tool to obtain the system hardware information described in the system BIOS according to SMBIOS/DMI standard

Options includes:

  1. bios,
  2. system,
  3. baseboard,
  4. chassis,
  5. processor,
  6. memory,
  7. cache,
  8. connector,
  9. slot

To obtain the information, just type

# dmidecode --type system

To get specific information such as serial number which will be useful for remote fault-reporting without making a trip to the data-center:

# dmidecode -s system-serial-number

To get a list of string keywords:

# dmidecode -s

Followup Articles:

  1. dmidecode: Finding Out Hardware Details Without Opening The Computer Case by HowToForge

Fixing your system with FirstAidKit

Since Fedora 10, FirstAidKit package has been included in the Fedora Distribution. Basically, Firstaidkit is an automated recovery tool that brings together common recovery processes and applies them to a system. It is built on top of a pluggable architecture.

  1. To install FirstAidKit
    # yum install firstaidkit
  2. To run the automated process of the recovery tool, run
    # firstaidkit -a
  3. To view a list of available plug-ins
    # firstaidkit --list
For more information on FirstAidKit, see First Aid Kit by Fedora

Using id commands to display user and group information

Learned a simple but effective commands today to display user and group information. That is "id"

# id your_userid

Tips on useradd and usermod commands

Today it is back to the basis again.

useradd and usermod are very often used utilities. They are several useful paramenters which we can use for the creation and maintenance of user accounts.

  • -c (Comments and Descriptions of the account. Using quotation is necessary if you are using multiple words
  • -d (home directory of the account. If -m is used, copy the home directory as well)
  • -e (Assign a expiration date for the account in MM/DD/YYYY format)
  • -f (Set the number of days after a password expires until the account is permanently disabled. The default option is -l which disable this option)
  • -g (primary group that the account belongs to)
  • -G (list of groups that user belongs to)
  • -l (Change login name of the account to the name supplied after -l option)
  • -u (Change the userid for the account) 

Setting Quota on CentOS Linux

Setting up Disk Quota on CentOS 5.x or Linux is rather straightforward. I'm assuming you are setting on a partition /dev/sdb1


Step 1: At the /etc/fstab, add "usrquota, grpquota" to the partition you wish to put quota on
/dev/sdb1 /home ext3 defaults,usrquota,grpquota 1 1


Step 2: Initialise aquota.user
# touch /dev/sdb1/aquota.user
# chmod 600 /dev/sdb1/aquota.user

Step 3: Remount the partition
# mount -o remount /dev/sdb1
# less /etc/mtab
(It should show
the list of file system having quota entry in Step 1)

Step 4: Do a Quotacheck commands and turn the quota on
#quotacheck -avugm /dev/sdb1
(The quotacheck command will do a scan and will take a while)
# quotaon -av
# quotatstats
(Check for statistics and possible error encountered)

Step 5: To edit a quota
# edquota -u user_id
(Edit the soft and hard limit respecitvely) or alternatively
# setquota -u user_id 100 200 0 0 -a /dev/sdb1
(where 100 and 200 are the block soft and hard limit respectively)


To quota summary report, do a repquota
# repoquota -a

Further Notes:
For more details readings,

FileLight - Visualise Disk Usage on computer

Filelight creates an interactive map of concentric, segmented rings that help visualise disk usage on your computer.

I tried on CentOS 5.2. Just make sure you have RPMForge repository.
# yum install filelight

Similarly, The Debian Derivative should have this package. I tried on Linux Mint 6
# apt-get install filelight

Cool....

Creating Packages with CheckInstall

Usually when we build source, we will usually use the familiar
# ./configure
# ./make
#./make install

However, you may want use CheckInstall as it first build a package (*.rpm or *.deb) and then install them. It thus also has the benefit of uninstalling later. If you are using Redhat derivative, you should find the package build in /usr/src/redhat/RPMS/

So with Checkinstall, the install procedure will be
#./configure
#./make
#./check install
OR
# ./configure && make && checkinstall

Notes:

Backup Software - Back In Time

Back In Time is a simple backup system for Linux inspired from “flyback project” and “TimeVault”. The backup is done by taking snapshots of a specified set of directories.

Currently there are two GUI available: Gnome and KDE 4 (>= 4.1).

All you have to do is configure:
  1. Where to save snapshot
  2. What directories to backup
  3. When backup should be done (manual, every hour, every day, every week, every month)
Back In Time URL: http://www.le-web.org/back-in-time/

10 Essential Tricks for System Administrators

This excellent article is taken from IBM Lazy Linux: 10 essential tricks for system administrators. The opening phrase is indeed interesting.

"The best systems adminsitrators are set apart by their efficiency.........."

  1. Trick 1: Unmounting the unresponsive DVD drive
  2. Trick 2: Getting your screen back when it's hosed
  3. Trick 3: Collaboration with screen
  4. Trick 4: Getting back the root password
  5. Trick 5: SSH back door
  6. Trick 6: Remote VNC session through an SSH tunnel
  7. Trick 7: Checking your bandwidth
  8. Trick 8: Command-line scripting and utilities
  9. Trick 9: Spying on the console
  10. Trick 10: Random system information collection

Wow......

Directory index forbidden by Options directive error for when displaying nagios

When you are unable to display the Nagios web after installation but encounter "Directory index forbidden by Options directive: .........." error. You need to set Apache to serve the file when the directory is requested.

To resolve the problem above. Go to
# vim /etc/httpd/conf/httpd.conf

Type the following into http.conf and restart apache and nagios


# service htpd restart
# service nagios restart

Understanding Login Sequence

Taken from Application Environment Setup Using /etc/profile.d/*

When a user login, the environment variables are set following the below order

  1. /etc/profile (for all users)
  2. /etc/profile.d (Application specific setup)
  3. ~/.bash_profile
  4. ~/.bashrc

For further information, read Login Sequence

Force users to change their passwords upon first login

Taken from Redhat Magazine: Tips and tricks: How do I force users to change their passwords upon first login?

  1. Firstly, lock the account to prevent the user from using the login until the change has been made:

    # usermod -L
  2. Change the password expiration date to 0 to ensure the user changes the password during the next login:

    # chage -d 0

  3. To unlock the account after the change do the following:

    # usermod -U

Analysing your DNS Traffic with dnstop

dnstop uses the pcap library to filter all the DNS queries on a computer network and display them on a terminal

Firstly install from repository
# apt-get install dnstop
# dnstop -l 3

Once you are inside the dnstop, you can use the following sort-cut
  • @ - Display the source of the query, domain target, volume and percentage of DNS Traffic
  • # - Similar to @ but with third level domain name

For more information, see the Dnstop project site