Posts Tagged ‘debian’


Credits to: http://nakedape.cc

NTP stands for Network Time Protocol, and it is an Internet protocol used to synchronize the clocks of computers to some time reference. NTP is an Internet standard protocol that is implemented via UDP over port 123. It is the best way to set your system clock correctly.

According to a Survey of the NTP Network, there were at least 175,000 hosts running NTP in the Internet. Source: http://alumni.media.mit.edu/~nelson/research/ntp-survey99/

Here is a step by step guide on how to configure NTP on your Ubuntu machine. Please read my previous post to better understand this guide for NTP Server and Client Configuration.

NTP Server Configuration

Step 1: Install NTP server on your machine.

sudo apt-get install ntp

Step 2: Configure NTP server. NTP’s default main configuration file is located at /etc/ntp.conf.
a: add a number of servers to the server list

server 0.asia.pool.ntp.org
server 1.asia.pool.ntp.org

b: restrict the server’s type of access

restrict otherntp.server.org mask 255.255.255.255 nomodify notrap noquery
restrict ntp.research.gov mask 255.255.255.255 nomodify notrap noquery

Servers are not allowed to modify the run-time configuration or query your own NTP server.

c: set the localhost to have full access without any restricting keywords

restrict 127.0.0.1

d: define the network where NTP synchronization requests are accecpted by the NTP server

restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

Step 3: Stop NTP.

/etc/init.d/ntp stop

Step 4: Run ntpdate command.

ntpdate 192.168.1.1

Step 5: Start NTP for the settings to take effect.

/etc/init.d/ntp restart

Step 6: Check if NTP is synchronized.

ntpq -p

Configured time servers are listed. For correct synchronization, the delay and offset values should be non-zero and the jitter value should be under 100.

NTP Client Configuration

Follow the same steps provided above and set your server configuration setting to your own server’s current ip address.
server configuration settings on ntp.conf

#server 192.168.1.1

Method of creating an account goes through the following steps (assuming the use of local files to hold account information)

1. Find the next available UID and GID numbers, or use the ones provided, checking they are unique
2. Add an entry to the /etc/passwd and /etc/shadow files using all the information provided, including a hash of the password into /etc/shadow
3. Create the home directory
4. Create a mail spool file /var/spool/mail/ username
5. Copy the files and directories from /etc/skel to the home directory
6. Change the ownership of the home directory and all its contents to the user, and the group ownership to the primary group of the user
7. Change the ownership of the mail spool file to the user, and make the group owner equal to mail

On Red Hat (and any other UNIX systems, useradd does all of the steps mentioned above, provided that a hash of the password is created.

On Debian Systems, adduser is more capable of than useradd. For the useradd command to be capable of doing the steps above, use its available options (See man useradd). People use adduser, instead.

List all currently installed packages.

dpgk --get-selections 

Find the location of a package

dpkg -L package

Package management automate the process of installing, upgrading, configuring, and removing software packages.
dpkg is the basic tool for package management. dpkg does not handle dependencies. Here’s a list of of tasks using dpkg.

Package Management Task using dpkg

Install a package: dpgk -i package-file
Remove a package: dpkg -r package-name
Purge a package: dpkg -P package-name
Find out which files a package owns: dpkg -L package-name
Find out which package a file belongs to: dpkg -S filename
Extract information from package: dpkg -e package-file
List contents of package-file: dpkg -c package-file

configuration file for dpkg (dpkg.cfg) is stored in /etc/dpkg directory.
/var/lib/dpkg/ directory contains package management status and system files. The most important are:
alternatives – contains files that define and store configuration for the command alternatives on the system.
available – information about packages available to the system, retrieved from every specified sources.
status – information about packages installed on, or removed from the system.

You may also use apt tool, the ultimate package tool to manage packages. apt handles dependecies and it is one of the strengths of dpkg. apt provides users an easy way of installing and upgrading a system. Here’s a list of tasks using apt.

Package Management Task using apt

Choose which mirror to download from: apt-setup
Allows CD-ROM to be scanned for packages: apt-cdrom
Search all package description: apt-cache search package-name
Search a package full description: apt-cache show package-name
Install a package: apt-get install package-name
update list of packages: apt-get update
Upgrade any packages: apt-get upgrade
Upgrade entire distribution: apt-get dist-upgrade
Remove package: apt-get remove package-name

Configuration file for apt is stored in /etc/apt directory. apt.conf contains general options for APT, such as which release of Debian to install, which proxy settings to use, etc.
apt.conf.d is managed by the software that integrates with apt such as dpkg-reconfigure and apt-list changes.
apt-config is useful for troubleshooting apt.conf problems.