viagra
phentermine

Posts Tagged ‘Linux’

Configuring dhcp Clients

Tuesday, February 12th, 2008

In Windows, open Control Panel -> Networking, then open the Properties box for TCP/IP. Check “Obtain an IP address automatically.”

It’s just as easy in Linux; the only hard part is that every distribution puts the configuration file in a different place. In Red Hat and Fedora, edit /etc/sysconfig/network-scripts/ifcfg-eth0 as follows:

TYPE=EthernetDEVICE=eth0

BOOTPROTO=dhcp

ONBOOT=yes

DHCP_HOSTNAME=stinkpad

On Debian, edit /etc/network/interfaces as follows:

auto loiface lo inet loopback

auto eth0

iface eth0 inet dhcp

You may wish to use a graphical configuration tool. On Red Hat and Fedora, use system-config-network. KDE and Gnome have their own GUI configuration tools (as does practically every Linux distribution), so you won’t be short of choices. Another option is netGo, a system-independent network configuration utility that lets you create profiles for easily connecting to different networks

Setting Up a DHCP Server

Tuesday, February 12th, 2008

Install and configure dhcp. You can get the source tarball from http://www.isc.org. RPMs and Debian packages are also available; just look for packages named "dhcp." Configure client PCs to point to your dhcp server, and you’re done.

A dhcp server can feed all network configuration data to the clients. The configuration file is /etc/dhcpd.conf. Here is a sample configuration:

# /etc/dhcpd.conf

default-lease-time 259200;

max-lease-time 518400;

subnet 192.168.1.0 netmask 255.255.255.0 {

   option subnet-mask 255.255.255.0;

   option broadcast-address 192.168.1.255;

   option routers 192.168.1.1;

   option domain-name "test.net";

   range 192.168.1.50 192.168.1.100;

   option domain-name-servers 152.163.199.56, 198.83.210.28;

}

This is pretty straightforward. The lease times are in seconds, so the minimum and maximum in this example are three days and six days. "Option routers" points to your Internet gateway, or the gateway to the subnet. A pool of 50 addresses is made available in the "range." The name servers are either your own private caching server or servers, or the name servers at your ISP.

This example uses private, nonroutable IPv4 (Internet Protocol Version 4) addresses. Here are the private IPv4 address classes, in both dotted-quad and Classless Inter-Domain Routing (CIDR) notation:

10.0.0.0     - 10.255.255.255  (10/8)

172.16.0.0   - 172.31.255.255  (172.16/12)

192.168.0.0  - 192.168.255.255 (192.168/16)

These are for use on private networks, so you’ll select your subnet ranges from these.

Managing Passwords

Friday, February 1st, 2008

Resetting a password is the solution to the perennial “I forgot my password” problem; many Linux administrators think it’s a good idea to “expire” passwords, forcing users to change them periodically.
To reset or change a password use:

# passwd aborg

Users can also change their own passwords:

aborg@server04:~$ passwd

This command sets aborg’s password to expire after six months, with five days’ warning:

# passwd -x 180 -w 5 -i 1 aborg

To view a user’s password settings, use:

# passwd -S option

aborg P 02/18/2004 0 10 5 1

Passwords can consist of numbers, letters, and punctuation marks, and they are case-sensitive. Don’t use spaces or function keys. Strong passwords work best—this means no names, no dictionary words, no birthdays or addresses. The best way to keep track of passwords is write them down and keep them in a safe place. Most people, if they can’t remember all of their passwords, end up choosing weak, easily guessable passwords, or leaving them in obvious, insecure places (such as on a note stuck to the monitor).

Linux passwords are not designed to be recoverable. If a password is lost, the user must depend on the benevolence of the superuser to create a new one.

Deleting a User

Friday, February 1st, 2008

If you need to delete a user, and you want to track down all the files that belong to the user, use userdel to delete the account, and use find to locate the files belonging to the user.

To delete a user:

# userdel aborg

The user cannot be logged in or running any processes for userdel to work.

userdel removes the user from all system account files (/etc/passwd, etc/shadow, /etc/group), but it does not touch files owned by the user. To remove the user’s home directory and mail spool, add the -r flag:

# userdel -r aborg

Other files, such as crontabs and data files outside the home directory, will have to be hunted down separately:

# find / -uid 1200

Adding Users with adduser

Friday, February 1st, 2008

If you want to use adduser instead of useradd, because it walks you through a complete new user setup—password, GECOS fields, and all, simply run adduser newusername and follow the prompts:

# adduser anitab
Adding user anitab…
Adding new group anitab (1008).
Adding new user anitab (1008) with group anitab.
Creating home directory /home/anitab.
Copying files from /etc/skel
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
Changing the user information for anitab
Enter the new value, or press ENTER for the default
Full Name [ ]:
Room Number [ ]:
Work Phone [ ]:
Home Phone [ ]:
Other [ ]:
Is the information correct? [y/n] y

You can assign a UID, overriding the default:

# adduser —uid 1500 anitab

adduser’s defaults are configured in /etc/adduser.conf