Archive for Config

How to attach a new hard disk to ubuntu linux

Posted in System with tags , , , on May 8, 2008 by wsjoung

root@server-tribeca:/etc# fdisk -l

Disk /dev/sda: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x9dc96e9e

Device Boot Start End Blocks Id System
/dev/sda1 * 1 4689 37664361 83 Linux
/dev/sda2 4690 4865 1413720 5 Extended
/dev/sda5 4690 4865 1413688+ 82 Linux swap / Solaris

Disk /dev/sdb: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00a080f4

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 13 104391 83 Linux
/dev/sdb2 14 14471 116133885 83 Linux
/dev/sdb3 14472 14593 979965 82 Linux swap / Solaris

root@server-tribeca:/etc# fdisk /dev/sdb

The number of cylinders for this disk is set to 14593.
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

Command (m for help): d
Partition number (1-4): 1

Command (m for help): d
Partition number (1-4): 2

Command (m for help): d
Selected partition 3

Command (m for help): d
No partition is defined yet!

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

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

Calling ioctl() to re-read partition table.
Syncing disks.

root@server-tribeca:/etc# mkfs.ext3 /dev/sdb1
mke2fs 1.40.8 (13-Mar-2008)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
7331840 inodes, 29304560 blocks
1465228 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
895 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 22 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

root@server-tribeca:/etc# ls /dev/disk/by-uuid -alh
lrwxrwxrwx 1 root root 10 2008-05-07 17:58 753a86d9-6228-4725-a9ae-6f457c2b1824 -> ../../sdb1
lrwxrwxrwx 1 root root 10 2008-05-07 17:58 dbd44197-c1c5-427d-9a34-40f652b92f42 -> ../../sda1
lrwxrwxrwx 1 root root 10 2008-05-07 17:58 e15f5c2c-fc1f-414d-8c67-99c567f44d6a -> ../../sda5

root@server-tribeca:/etc# mkdir /disk1

root@server-tribeca:/etc# vi /etc/fstab
# /etc/fstab: static file system information.
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
# /dev/sda1
UUID=dbd44197-c1c5-427d-9a34-40f652b92f42 / ext3 relatime,errors=remount-ro 0 1
# /dev/sda5
UUID=e15f5c2c-fc1f-414d-8c67-99c567f44d6a none swap sw 0 0
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0
/dev/fd0 /media/floppy0 auto rw,user,noauto,exec,utf8 0 0
UUID=753a86d9-6228-4725-a9ae-6f457c2b1824 /disk1 ext3 defaults,errors=remount-ro 0 1

Changing Timezon and NTP On Ubuntu server

Posted in System with tags , , , on May 5, 2008 by wsjoung

Timezon Config

dpkg-reconfigure tzdata

Time Synchronisation with NTP

as root, create a file /etc/cron.daily/ntpdate containing:
The file /etc/cron.daily/ntpdate must also be executable
sudo chmod 755 /etc/cron.daily/ntpdate

pure-ftpd-mysql, [ERROR] Home directory not available – aborting

Posted in System with tags , , , , on April 15, 2008 by wsjoung

groupadd -g 2001 ftpgroup
useradd -u 2001 -s /bin/false -d /bin/null -c “pureftpd user” -g ftpgroup ftpuser

Instead of this dummy ftpuser account setting when they want to create real linux account.
they may get this error “Home directory not available – abort” even if they set CreateHomeDir to yes.

the last existing in the home path should be own by root.
for example, we want to create somebody’s home directory when he log in, /home/ftpuser/somebody
then the last existing directory ‘ftpuer’ may look like this,
drwxr-xr-x 2 root ftpgroup 4096 2008-04-15 11:20 ftpuser

[pure-ftpd] CreateHomeDir problem (“[ERROR] Home directory not available – aborting”)
Virtual Hosting With PureFTPd And MySQL (Incl. Quota And Bandwidth Management) On Ubuntu 7.10 (Gutsy Gibbon)

mod_rewrite: Apache URL Rewriting

Posted in Server with tags , , , on January 24, 2007 by wsjoung

People loves to apply MVC model pretty much on their web application project. They likely put a controller which takes user input from the request and figures out what it means to the model. In this case, URL may looks like this, “index.php?category=sub”. It’s not pretty at all. If we can make this “category/sub”. it would be much better for search engine and users; security reason as well.

Module mod_rewrite URL Rewriting Engine
mod_rewrite, a beginner’s guide (with examples)
mod_rewrite: A Beginner’s Guide to URL Rewriting
mod_rewrite Cheat Sheet

Samba Setting: Secure Read-Write File and Print Server

Posted in System with tags , , , on November 17, 2006 by wsjoung

Secure Read-Write File and Print Server

We progress now from simple systems to a server that is slightly more complex.

Our new server will require a public data storage area in which only authenticated users (i.e., those with a local account) can store files, as well as a home directory. There will be one printer that should be available for everyone to use.

In this hypothetical environment (no espionage was conducted to obtain this data), the site is demanding a simple environment that is secure enough but not too difficult to use.

Site users will be Jack Baumbach, Mary Orville, and Amed Sehkah. Each will have a password (not shown in further examples). Mary will be the printer administrator and will own all files in the public share.

This configuration will be based on user-level security that is the default, and for which the default is to store Microsoft Windows-compatible encrypted passwords in a file called /etc/samba/smbpasswd. The default smb.conf entry that makes this happen is passdb backend = smbpasswd, guest. Since this is the default, it is not necessary to enter it into the configuration file. Note that the guest backend is added to the list of active passdb backends no matter whether it specified directly in Samba configuration file or not.

Procedure 2.2. Installing the Secure Office Server

Example 2.4. Secure Office Server smb.conf
# Global parameters
workgroup = MIDEARTH
netbios name = OLORIN
printcap name = cups
disable spoolss = Yes
show add printer wizard = No
printing = cups
comment = Home Directories
valid users = %S
read only = No
browseable = No
comment = Data
path = /export
force user = maryo
force group = users
guest ok = Yes
read only = No
comment = All Printers
path = /var/spool/samba
printer admin = root, maryo
create mask = 0600
guest ok = Yes
printable = Yes
use client driver = Yes
browseable = No

1. Add all users to the operating system:
root# useradd -c “Jack Baumbach” -m -g users -p m0r3pa1n jackb
root# useradd -c “Mary Orville” -m -g users -p secret maryo
root# useradd -c “Amed Sehkah” -m -g users -p secret ameds

2. Configure the Samba smb.conf file as shown above

3. Initialize the Microsoft Windows password database with the new users:
root# smbpasswd -a root
New SMB password: bigsecret
Reenter smb password: bigsecret
Added user root.

root# smbpasswd -a jackb
New SMB password: m0r3pa1n
Retype new SMB password: m0r3pa1n
Added user jackb.

root# smbpasswd -a maryo
New SMB password: secret
Reenter smb password: secret
Added user maryo.

root# smbpasswd -a ameds
New SMB password: mysecret
Reenter smb password: mysecret
Added user ameds.

4. Install printer using the CUPS Web interface. Make certain that all printers that will be shared with Microsoft Windows clients are installed as raw printing devices.

5. Start Samba using the operating system administrative interface. Alternately, this can be done manually by executing:

root# nmbd; smbd;

Both applications automatically execute as daemons. Those who are paranoid about maintaining control can add the -D flag to coerce them to start up in daemon mode.

6. Configure the /export directory:
root# mkdir /export
root# chown maryo.users /export
root# chmod u=rwx,g=rwx,o-rwx /export

7. Check that Samba is running correctly:
root# smbclient -L localhost -U%

The following error message indicates that Samba was not running:
Error connecting to (Connection refused)
Connection to olorin failed

8. Connect to OLORIN as maryo:
root# smbclient //olorin/maryo -Umaryo%secret
OS=[UNIX] Server=[Samba-3.0.20]
smb: \> dir
smb: \> q

By now you should be getting the hang of configuration basics. Clearly, it is time to explore slightly more complex examples. For the remainder of this chapter we abbreviate instructions, since there are previous examples.

The Official Samba-3 HOWTO and Reference Guide

Easy installation of Struts

Posted in J2EE with tags , , , on November 11, 2006 by wsjoung

It seems like that Struts is a part of J2EE now, so I think it should be included in J2EE default package!! or maybe I should try JSF.
Download Struts from

1. Extract downloaded file

2. COPY war files which are under “<Struts>/webapps dir” INTO “<Tomcat>/webapps dir”

3. COPY jar files which are under “<Struts>/lib dir” INTO “<J2SDK>/jre/lib/ext dir”

4. Tomcat restart, That’s it!