go get auto_increment
SHOW TABLE STATUS LIKE 'tablename'
๑๒/๒๑/๒๕๕๒
๑๒/๐๘/๒๕๕๒
Sendmail + MySQL + Slackware
Mail + MySQL
จุดประสงค์
ไม่ต้องการให้ E-mail Users เป็น users ของระบบ แต่จะเก็บรายชื่อ และ Password ของผู้ใช้งาน email ไว้ใน table ของ MySQLเหตุผล
เพื่อความปลอดภัยของระบบ เพราะ users จะไม่สามารถใช้ users และ password นั้น ๆ เพื่อ login เข้าระบบได้ อาจจะเพื่อเหตุผลอื่น ๆ อีก แต่ยังนึกไม่ออก ว่าทำไมต้องทำแบบนี้ ที่ลองทำเพราะ มีหลายคนพูดถึง และสอบถามมาว่าเคยลองทำหรือไม่๑๑/๒๘/๒๕๕๒
Python server page
http://www.modpython.org/live/current/doc-html/pyapi-psp.html
psp - Python Server Pages
The psp module provides a way to convert text documents (including, but
not limited to HTML documents) containing Python code embedded in
special brackets into pure Python code suitable for execution within a
mod_python handler, thereby providing a versatile mechanism for
delivering dynamic content in a style similar to ASP, JSP and others.
The parser used by psp is written in C (generated using flex) and is
therefore very fast.
๑๑/๒๐/๒๕๕๒
Proftp 1.3.2 with mysql
: undefined reference to `compress'
/usr/local/mysql/lib/libmysqlclient.a(my_compress.o)(.text+0x116): In function `my_compress_alloc':
: undefined reference to `compress'
/usr/local/mysql/lib/libmysqlclient.a(my_compress.o)(.text+0x18d): In function `my_uncompress':
: undefined reference to `uncompress'
collect2: ld returned 1 exit status
make: *** [proftpd] Error 1
I had the same problem and fixed it doing the following
Open contrib/mod_sql_mysql.c and find the following line:
Code:
#include
Before mysql.h you need to add the directory where this file is in. In my case (used the RPM's from mysql.org):
Code:
#include
Now run configure as follows
Code:
./configure --prefix=/usr/local/proftpd --sysconfdir=/etc/proftpd --with-modules=mod_sql:mod_sql_mysql --with-zlib
Offcourse you can use any prefix, sysconfdir or extra modules. Just keep --with-zlib in the line.
Hope this helps,
Dennis
http://forums.proftpd.org/smf/index.php?topic=1113.0
***************************
Try
./configure --with-modules=mod_sql:mod_sql_mysql:mod_quotatab:mod_quotatab_sql --with-includes=/usr/l
ocal/mysql/include/ --with-libraries=/usr/lib:/usr/local/mysql/lib/lib --with-zilb
http://www.proftpd.org/localsite/Userguide/linked/x1462.html
./Make.rules Replaced LIBS=-lsupp -ldl -lcrypt -lm -lmysqlclient -lpam by LIBS=-lsupp -ldl -lcrypt -lm -lm
/usr/local/mysql/lib/mysql/libmysqlclient.a -lpam ./modules/mod_mysql.c and ./modules/mod_sqlpw.c
===================== done an ln -s of these files from ./contrib to ./modules and replaced in _both_ files : #include
by #include "/usr/local/mysql/include/mysql/mysql.h" ./modules/Makefile ================== Removed the line
mod_mysql.o: mod_mysql.h (there are no mod_mysql.h anymore) Finally, I compiled the whole by : ./configure --with-
modules=mod_sqlpw:mod_mysql --prefix=/usr/local make make install Results : Oct 24 22:23:53 omega proftpd[7415]:
omega.omnis.ch - ProFTPD 1.2.0pre8 standalone mode STARTUP I think it would be nice to correct ./modules/Makefile in the CVS,
and why not to add symlinks from ./contrib to ./modules ?
LIBS=-lsupp -ldl -lcrypt -lm -lm /usr/local/mysql/lib/mysql/libmysqlclient.a
#LIBS= -lcap -lm -lmysqlclient -lz -lsupp -lcrypt
LIBS= -lsupp -ldl -lcrypt -lm -lm /usr/local/mysql/lib/libmysqlclient.a
Sove:
add -lz
LIBS= -lsupp -ldl -lcrypt -lm -lz /usr/local/mysql/lib/libmysqlclient.a
********************************
$make
....
modules/mod_cap.o: In function `lp_add_cap':
mod_cap.c:(.text+0x1a): undefined reference to `cap_set_flag'
modules/mod_cap.o: In function `lp_set_cap':
mod_cap.c:(.text+0x6d): undefined reference to `cap_set_proc'
modules/mod_cap.o: In function `lp_free_cap':
mod_cap.c:(.text+0xda): undefined reference to `cap_free'
modules/mod_cap.o: In function `cap_post_pass':
mod_cap.c:(.text+0x150): undefined reference to `cap_init'
mod_cap.c:(.text+0x226): undefined reference to `cap_get_proc'
mod_cap.c:(.text+0x23d): undefined reference to `cap_to_text'
mod_cap.c:(.text+0x260): undefined reference to `cap_free'
mod_cap.c:(.text+0x268): undefined reference to `cap_free'
mod_cap.c:(.text+0x496): undefined reference to `cap_free'
modules/mod_cap.o: In function `cap_module_init':
mod_cap.c:(.text+0x507): undefined reference to `cap_get_proc'
mod_cap.c:(.text+0x514): undefined reference to `cap_free'
collect2: ld returned 1 exit status
make: *** [proftpd] Error 1
solve:
edit Make.rules
add -lcap on the line
LIBS= -lsupp -ldl -lcrypt -lm -lz -lcap /usr/local/mysql/lib/libmysqlclient.a
http://www.phpbuilder.com/board/archive/index.php/t-7102626.html
888888888888
Full Guide
888888888888
http://www.khoosys.net/single.htm?ipg=848
Mandrake 10.1 - Proftpd + MySQL authentication + Quotas Howto
Author: Stephen Khoo
– Please read the notes on the main Mandrake install guide first! –
Updated: 11 March 2005
Summary
This Howto describes how to build and configure proftpd (v 1.2.9) using a MySQL database for authentication and quota management.
The base machine is setup using Mandrake 10.1, so we assume you have installed the base set of MySQL rpms including the
development libraries and headers which places the headers in /usr/include/mysql and the libraries in /usr/lib. Please see our earlier
Howto guide:
Installation
The easiest is to install proftpd from the Mandrake rpms and overwrite /usr/sbin/proftpd with a symlink to the one you create here in
/usr/local/sbin. You can't use the rpm version of proftpd as it doesn't have MySQL support built in.
Log in as your user account to do the installation. Instructions in bold should be done as root.
You should be able to copy and paste the text in the yellow boxes straight into your Mandrake PC. We have tested this on a clean
server and it all seems to work fine. If you have any problems use the Discussion Forum on this site to let us know. You can always let
us know if this is useful anyway!
Get the sources
# as user
cd
mkdir src
cd src
# Proftpd source - note that this contains mod_sql and mod_quotatab
wget ftp://ftp.proftpd.org/distrib/source/proftpd-1.2.10.tar.gz
Note: make sure that your path to the installation directory does not contain spaces in any of the directory names as this confuses the
./configure script totally!
Unpack sources
# as user
cd
mkdir proftpd
cd proftpd
# Unpack sources
tar -xzf ../src/proftpd-1.2.10.tar.gz
Compile and install
This assumes that the MySQL libraries and headers are placed where Mandrake puts them (i.e. /usr/lib and /usr/include/mysql
respectively). If you have used a different MySQL installation you just need to check that you get the path to these MySQL files correct.
cd proftpd-1.2.10
./configure --with-modules=mod_sql:mod_sql_mysql:mod_quotatab:mod_quotatab_sql \
--with-includes=/usr/include/mysql \
--with-libraries=/usr/lib
make
su
make install
# make a symbolic link to the installed binary in /usr/sbin - overwriting the one from the rpm if installed
# so that the startup script works OK
mv /usr/sbin/proftpd /usr/sbin/proftpd.rpmsave
ln -s /usr/local/sbin/proftpd /usr/sbin/proftpd
Unix Configuration
As far as UNIX is concerned we use one real group account ftpgroup (id 5500) as every user will be jailed to their home directory
using the 'DefaultRoot ~/' directive. We set up one main ftpuser account (id: 5500) with this group and a guest account ftpguest (id
5501).
groupadd -g 5500 ftpgroup
adduser -u 5500 -s /bin/false -d /bin/null -c "proftpd user" -g ftpgroup ftpuser
Note: I also add a guest user so that your client sites can have a place for their guest users to transfer files. Just run:
adduser -u 5501 -s /bin/false -d /bin/null -c "proftpd guest" -g ftpgroup ftpguest
add a password and then remember to add them to your database as members of the ftpgroup by adding a new record there.
To add a guest user, add a record for a user with userid of 5501 and set the permissions on the folders you want to share like this:
chmod 755 From_folder
chmod 731 To_folder
leaving the user and group as ftpuser.ftpgroup
Their clients will now only be able to download from the From_folder and drop files, but not list files in the To_folder.
MySQL Configuration
Create the database tables in MySQL for authentication and logging.
We use a database called ftpdb which we access using a MySQL user proftpd with password 'password'. (Clearly substitute your own
password in here).
You need to log into MySQL using your root account and password.
mysql -u root -p
create database ftpdb;
grant select, insert, update on ftpdb.* to proftpd@localhost identified by 'password';
use ftpdb;
#
# Table structure for table `ftpgroup`
#
CREATE TABLE ftpgroup (
groupname varchar(16) NOT NULL default '',
gid smallint(6) NOT NULL default '5500',
members varchar(16) NOT NULL default '',
KEY groupname (groupname)
) TYPE=MyISAM COMMENT='ProFTP group table';
#
# Dumping data for table `ftpgroup`
#
INSERT INTO `ftpgroup` VALUES ('ftpgroup', 5500, 'ftpuser');
INSERT INTO `ftpgroup` VALUES ('ftpgroup', 5500, 'ftpguest');
# --------------------------------------------------------
#
# Table structure for table `ftpquotalimits`
#
CREATE TABLE ftpquotalimits (
name varchar(30) default NULL,
quota_type enum('user','group','class','all') NOT NULL default 'user',
per_session enum('false','true') NOT NULL default 'false',
limit_type enum('soft','hard') NOT NULL default 'soft',
bytes_in_avail int(10) unsigned NOT NULL default '0',
bytes_out_avail int(10) unsigned NOT NULL default '0',
bytes_xfer_avail int(10) unsigned NOT NULL default '0',
files_in_avail int(10) unsigned NOT NULL default '0',
files_out_avail int(10) unsigned NOT NULL default '0',
files_xfer_avail int(10) unsigned NOT NULL default '0'
) TYPE=MyISAM;
# --------------------------------------------------------
#
# Table structure for table `ftpquotatallies`
#
CREATE TABLE ftpquotatallies (
name varchar(30) NOT NULL default '',
quota_type enum('user','group','class','all') NOT NULL default 'user',
bytes_in_used int(10) unsigned NOT NULL default '0',
bytes_out_used int(10) unsigned NOT NULL default '0',
bytes_xfer_used int(10) unsigned NOT NULL default '0',
files_in_used int(10) unsigned NOT NULL default '0',
files_out_used int(10) unsigned NOT NULL default '0',
files_xfer_used int(10) unsigned NOT NULL default '0'
) TYPE=MyISAM;
#
# Table structure for table `ftpquotatallies`
#
CREATE TABLE `ftpquotatallies` (
`name` varchar(30) NOT NULL default '',
`quota_type` enum('user','group','class','all') NOT NULL default 'user',
`bytes_in_used` float NOT NULL default '0',
`bytes_out_used` float NOT NULL default '0',
`bytes_xfer_used` float NOT NULL default '0',
`files_in_used` int(10) unsigned NOT NULL default '0',
`files_out_used` int(10) unsigned NOT NULL default '0',
`files_xfer_used` int(10) unsigned NOT NULL default '0'
) TYPE=MyISAM;
# --------------------------------------------------------
#
# Table structure for table `ftpuser`
#
CREATE TABLE ftpuser (
id int(10) unsigned NOT NULL auto_increment,
userid varchar(32) NOT NULL default '',
passwd varchar(32) NOT NULL default '',
uid smallint(6) NOT NULL default '5500',
gid smallint(6) NOT NULL default '5500',
homedir varchar(255) NOT NULL default '',
shell varchar(16) NOT NULL default '/sbin/nologin',
count int(11) NOT NULL default '0',
accessed datetime NOT NULL default '0000-00-00 00:00:00',
modified datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (id),
UNIQUE KEY userid (userid)
) TYPE=MyISAM COMMENT='ProFTP user table';
INSERT INTO `ftpuser` VALUES (1, 'testaccount', 'ftppasswd', 5500, 5500, '/home/testdomain.com', '/sbin/nologin',0,'','');
exit;
Notes:
* The group table lists the members of each group. This does not need any records for a simple setup.
* The user table lists each of your ftp users and records their stats and is used for authentication and pointing proftpd to the correct
home directory. Using the directive 'asdfasf' we make proftpd create the home directory if one does not already exist.
* The quotalimits table is used to se the current quota for the user matching its entry.
* The quotatallies table is used by proftpd to keep track of the user's quotas and will be filled if there is a matching userfield 'name'
when a user logs in.
* We have added a user test account just called "testaccount" to check things are working ok.
Field Explanations:
quotalimits
name - username
quota_type - user, group, class, all (we use user)
per_session - true or false (we use true)
limit_type - quota limit type - hard or soft (we use hard)
bytes_in_avail - upload limit in bytes - allowed bytes on disk (eg diskquota)
bytes_out_avail - download limit in bytes - allowed bytes a user can download
bytes_xfer_avail - allowed bytes a user can transfer in/out
files_in_avail - upload limit in files - allowed number of uploaded files
files_out_avail - allowed number of downloaded files
files_xfer_avail - allowed number of files a user can transfer in/out
quotatallies
name
quota_type
bytes_in_used - upload tally in bytes
bytes_out_used - download tally in bytes
bytes_xfer_used - transfer tally in bytes
files_in_used - upload tally in files
files_out_used - download tally in files
files_xfer_used - transfer tally in files
If a value of any limit field is set to '0' it is unlimited.
You can read the documentation that comes with mod_quotatab for mysql here.
Author's Note:
You can test a 15MB quota limit on 'testaccount' by inserting this record into 'quotalimits':
INSERT INTO quotalimits VALUES('testaccount','user','true','hard','15728640','0','0','0','0','0');
I think you have to log in with this record in place before it works. It also will allow you to upload, but then deletes the file if you are
over the limit. This is a bit irritating because on normal user disk quotas, you get a message as you try to upload, not after. So you
might get some unhappy users who don't know why they can't upload. Also the message that you have exceeded the limit appears in
the ftp client transcript and your users will miss this if they don't show transcripts.
On a related note, I can seem to get any joy out of the quotatallies stuff. When I get more time, I may investigate this. In the
meantime, if any of you find out what is going on there, it would be cool if you leave a note in the forum here - then everyone can
benefit.
Proftpd Config File
Here is our complete configuration file setup with MySQL and quota support. Keep a copy of the installation one in /usr/local/etc/ and
replace with one like this - change to suit your ServerName and ServerAdmin and MySQL database login details.
ServerName "Khoosys Proftpd Server"
ServerType Standalone
ServerAdmin stephen@khoosys.net
# Hide as much as possible to outside users
ServerIdent on "Welcome to the Khoosys FTP server. Please login..."
DeferWelcome on
DefaultServer on
# Allow FTP resuming.
# Remember to set to off if you have an incoming ftp for upload.
AllowStoreRestart on
# Port 21 is the standard FTP port.
Port 21
# Umask 022 is a good standard umask to prevent new dirs and files
# from being group and world writable.
Umask 022
# To prevent DoS attacks, set the maximum number of child processes
# to 30. If you need to allow more than 30 concurrent connections
# at once, simply increase this value. Note that this ONLY works
# in standalone mode, in inetd mode you should use an inetd server
# that allows you to limit maximum number of processes per service
# (such as xinetd).
MaxInstances 30
# Set the user and group under which the server will run.
User nobody
Group nogroup
# To cause every FTP user to be "jailed" (chrooted) into their home
# directory, uncomment this line.
DefaultRoot ~
# Normally, we want files to be overwriteable.
AllowOverwrite on
# The passwords in MySQL are encrypted using CRYPT
SQLAuthTypes Plaintext Crypt
SQLAuthenticate users* groups*
# used to connect to the database
# databasename@host database_user user_password
SQLConnectInfo ftpdb@localhost proftpd password
# Here we tell ProFTPd the names of the database columns in the "usertable"
# we want it to interact with. Match the names with those in the db
SQLUserInfo ftpuser userid passwd uid gid homedir shell
# Here we tell ProFTPd the names of the database columns in the "grouptable"
# we want it to interact with. Again the names match with those in the db
SQLGroupInfo ftpgroup groupname gid members
# set min UID and GID - otherwise these are 999 each
SQLMinID 500
# create a user's home directory on demand if it doesn't exist
SQLHomedirOnDemand on
# Update count every time user logs in
SQLLog PASS updatecount
SQLNamedQuery updatecount UPDATE "count=count+1, accessed=now() WHERE userid='%u'" ftpuser
# Update modified everytime user uploads or deletes a file
SQLLog STOR,DELE modified
SQLNamedQuery modified UPDATE "modified=now() WHERE userid='%u'" ftpuser
# User quotas
# ===========
QuotaEngine on
QuotaDirectoryTally on
QuotaDisplayUnits Mb
QuotaShowQuotas on
SQLNamedQuery get-quota-limit SELECT "name, quota_type, per_session, limit_type, bytes_in_avail, bytes_out_avail,
bytes_xfer_avail, files_in_avail, files_out_avail, files_xfer_avail FROM ftpquotalimits WHERE name = '%{0}' AND quota_type = '%{1}'"
SQLNamedQuery get-quota-tally SELECT "name, quota_type, bytes_in_used, bytes_out_used, bytes_xfer_used, files_in_used,
files_out_used, files_xfer_used FROM ftpquotatallies WHERE name = '%{0}' AND quota_type = '%{1}'"
SQLNamedQuery update-quota-tally UPDATE "bytes_in_used = bytes_in_used + %{0}, bytes_out_used = bytes_out_used + %{1},
bytes_xfer_used = bytes_xfer_used + %{2}, files_in_used = files_in_used + %{3}, files_out_used = files_out_used + %{4},
files_xfer_used = files_xfer_used + %{5} WHERE name = '%{6}' AND quota_type = '%{7}'" ftpquotatallies
SQLNamedQuery insert-quota-tally INSERT "%{0}, %{1}, %{2}, %{3}, %{4}, %{5}, %{6}, %{7}" ftpquotatallies
QuotaLimitTable sql:/get-quota-limit
QuotaTallyTable sql:/get-quota-tally/update-quota-tally/insert-quota-tally
RootLogin off
RequireValidShell off
Proftpd startup file
As you can see we start proftpd as a standalone process and not as an xinetd service. We use the proftpd startup script provided by
the rpm distribution. You can download it here.
Testing
Start the service using /etc/rc.d/init.d/proftpd and login to the ftp server using 'testaccount' and 'ftppasswd'.
If the home directory '/home/testdomain.com' does not already exist it will be created.
Have fun!!
A few useful tips
If you want to check that queries are coming through to MySQL, turn on logging by adding a line to your MySQL configuration file such
as: log=/var/lib/mysql/mysql.log
Remember to turn off logging when you are done as it will slow things down with it on!
(Note that the MySQL config file is usually '/etc/my.cnf'. If you don't have one MySQL usually provides a set which you can copy
according to the size of server you want to run. For example, a huge server can use : '/usr/share/mysql/my-huge.cnf')
Useful links
* http//www.castaglia.org/proftpd/doc/contrib/ProFTPD-mini-HOWTO-SQL.html
* http//www.lastditcheffort.org/aah/proftpd/mod_sql/
/usr/local/mysql/lib/libmysqlclient.a(my_compress.o)(.text+0x116): In function `my_compress_alloc':
: undefined reference to `compress'
/usr/local/mysql/lib/libmysqlclient.a(my_compress.o)(.text+0x18d): In function `my_uncompress':
: undefined reference to `uncompress'
collect2: ld returned 1 exit status
make: *** [proftpd] Error 1
I had the same problem and fixed it doing the following
Open contrib/mod_sql_mysql.c and find the following line:
Code:
#include
Before mysql.h you need to add the directory where this file is in. In my case (used the RPM's from mysql.org):
Code:
#include
Now run configure as follows
Code:
./configure --prefix=/usr/local/proftpd --sysconfdir=/etc/proftpd --with-modules=mod_sql:mod_sql_mysql --with-zlib
Offcourse you can use any prefix, sysconfdir or extra modules. Just keep --with-zlib in the line.
Hope this helps,
Dennis
http://forums.proftpd.org/smf/index.php?topic=1113.0
***************************
Try
./configure --with-modules=mod_sql:mod_sql_mysql:mod_quotatab:mod_quotatab_sql --with-includes=/usr/l
ocal/mysql/include/ --with-libraries=/usr/lib:/usr/local/mysql/lib/lib --with-zilb
http://www.proftpd.org/localsite/Userguide/linked/x1462.html
./Make.rules Replaced LIBS=-lsupp -ldl -lcrypt -lm -lmysqlclient -lpam by LIBS=-lsupp -ldl -lcrypt -lm -lm
/usr/local/mysql/lib/mysql/libmysqlclient.a -lpam ./modules/mod_mysql.c and ./modules/mod_sqlpw.c
===================== done an ln -s of these files from ./contrib to ./modules and replaced in _both_ files : #include
mod_mysql.o: mod_mysql.h (there are no mod_mysql.h anymore) Finally, I compiled the whole by : ./configure --with-
modules=mod_sqlpw:mod_mysql --prefix=/usr/local make make install Results : Oct 24 22:23:53 omega proftpd[7415]:
omega.omnis.ch - ProFTPD 1.2.0pre8 standalone mode STARTUP I think it would be nice to correct ./modules/Makefile in the CVS,
and why not to add symlinks from ./contrib to ./modules ?
LIBS=-lsupp -ldl -lcrypt -lm -lm /usr/local/mysql/lib/mysql/libmysqlclient.a
#LIBS= -lcap -lm -lmysqlclient -lz -lsupp -lcrypt
LIBS= -lsupp -ldl -lcrypt -lm -lm /usr/local/mysql/lib/libmysqlclient.a
Sove:
add -lz
LIBS= -lsupp -ldl -lcrypt -lm -lz /usr/local/mysql/lib/libmysqlclient.a
********************************
$make
....
modules/mod_cap.o: In function `lp_add_cap':
mod_cap.c:(.text+0x1a): undefined reference to `cap_set_flag'
modules/mod_cap.o: In function `lp_set_cap':
mod_cap.c:(.text+0x6d): undefined reference to `cap_set_proc'
modules/mod_cap.o: In function `lp_free_cap':
mod_cap.c:(.text+0xda): undefined reference to `cap_free'
modules/mod_cap.o: In function `cap_post_pass':
mod_cap.c:(.text+0x150): undefined reference to `cap_init'
mod_cap.c:(.text+0x226): undefined reference to `cap_get_proc'
mod_cap.c:(.text+0x23d): undefined reference to `cap_to_text'
mod_cap.c:(.text+0x260): undefined reference to `cap_free'
mod_cap.c:(.text+0x268): undefined reference to `cap_free'
mod_cap.c:(.text+0x496): undefined reference to `cap_free'
modules/mod_cap.o: In function `cap_module_init':
mod_cap.c:(.text+0x507): undefined reference to `cap_get_proc'
mod_cap.c:(.text+0x514): undefined reference to `cap_free'
collect2: ld returned 1 exit status
make: *** [proftpd] Error 1
solve:
edit Make.rules
add -lcap on the line
LIBS= -lsupp -ldl -lcrypt -lm -lz -lcap /usr/local/mysql/lib/libmysqlclient.a
http://www.phpbuilder.com/board/archive/index.php/t-7102626.html
888888888888
Full Guide
888888888888
http://www.khoosys.net/single.htm?ipg=848
Mandrake 10.1 - Proftpd + MySQL authentication + Quotas Howto
Author: Stephen Khoo
– Please read the notes on the main Mandrake install guide first! –
Updated: 11 March 2005
Summary
This Howto describes how to build and configure proftpd (v 1.2.9) using a MySQL database for authentication and quota management.
The base machine is setup using Mandrake 10.1, so we assume you have installed the base set of MySQL rpms including the
development libraries and headers which places the headers in /usr/include/mysql and the libraries in /usr/lib. Please see our earlier
Howto guide:
Installation
The easiest is to install proftpd from the Mandrake rpms and overwrite /usr/sbin/proftpd with a symlink to the one you create here in
/usr/local/sbin. You can't use the rpm version of proftpd as it doesn't have MySQL support built in.
Log in as your user account to do the installation. Instructions in bold should be done as root.
You should be able to copy and paste the text in the yellow boxes straight into your Mandrake PC. We have tested this on a clean
server and it all seems to work fine. If you have any problems use the Discussion Forum on this site to let us know. You can always let
us know if this is useful anyway!
Get the sources
# as user
cd
mkdir src
cd src
# Proftpd source - note that this contains mod_sql and mod_quotatab
wget ftp://ftp.proftpd.org/distrib/source/proftpd-1.2.10.tar.gz
Note: make sure that your path to the installation directory does not contain spaces in any of the directory names as this confuses the
./configure script totally!
Unpack sources
# as user
cd
mkdir proftpd
cd proftpd
# Unpack sources
tar -xzf ../src/proftpd-1.2.10.tar.gz
Compile and install
This assumes that the MySQL libraries and headers are placed where Mandrake puts them (i.e. /usr/lib and /usr/include/mysql
respectively). If you have used a different MySQL installation you just need to check that you get the path to these MySQL files correct.
cd proftpd-1.2.10
./configure --with-modules=mod_sql:mod_sql_mysql:mod_quotatab:mod_quotatab_sql \
--with-includes=/usr/include/mysql \
--with-libraries=/usr/lib
make
su
make install
# make a symbolic link to the installed binary in /usr/sbin - overwriting the one from the rpm if installed
# so that the startup script works OK
mv /usr/sbin/proftpd /usr/sbin/proftpd.rpmsave
ln -s /usr/local/sbin/proftpd /usr/sbin/proftpd
Unix Configuration
As far as UNIX is concerned we use one real group account ftpgroup (id 5500) as every user will be jailed to their home directory
using the 'DefaultRoot ~/' directive. We set up one main ftpuser account (id: 5500) with this group and a guest account ftpguest (id
5501).
groupadd -g 5500 ftpgroup
adduser -u 5500 -s /bin/false -d /bin/null -c "proftpd user" -g ftpgroup ftpuser
Note: I also add a guest user so that your client sites can have a place for their guest users to transfer files. Just run:
adduser -u 5501 -s /bin/false -d /bin/null -c "proftpd guest" -g ftpgroup ftpguest
add a password and then remember to add them to your database as members of the ftpgroup by adding a new record there.
To add a guest user, add a record for a user with userid of 5501 and set the permissions on the folders you want to share like this:
chmod 755 From_folder
chmod 731 To_folder
leaving the user and group as ftpuser.ftpgroup
Their clients will now only be able to download from the From_folder and drop files, but not list files in the To_folder.
MySQL Configuration
Create the database tables in MySQL for authentication and logging.
We use a database called ftpdb which we access using a MySQL user proftpd with password 'password'. (Clearly substitute your own
password in here).
You need to log into MySQL using your root account and password.
mysql -u root -p
create database ftpdb;
grant select, insert, update on ftpdb.* to proftpd@localhost identified by 'password';
use ftpdb;
#
# Table structure for table `ftpgroup`
#
CREATE TABLE ftpgroup (
groupname varchar(16) NOT NULL default '',
gid smallint(6) NOT NULL default '5500',
members varchar(16) NOT NULL default '',
KEY groupname (groupname)
) TYPE=MyISAM COMMENT='ProFTP group table';
#
# Dumping data for table `ftpgroup`
#
INSERT INTO `ftpgroup` VALUES ('ftpgroup', 5500, 'ftpuser');
INSERT INTO `ftpgroup` VALUES ('ftpgroup', 5500, 'ftpguest');
# --------------------------------------------------------
#
# Table structure for table `ftpquotalimits`
#
CREATE TABLE ftpquotalimits (
name varchar(30) default NULL,
quota_type enum('user','group','class','all') NOT NULL default 'user',
per_session enum('false','true') NOT NULL default 'false',
limit_type enum('soft','hard') NOT NULL default 'soft',
bytes_in_avail int(10) unsigned NOT NULL default '0',
bytes_out_avail int(10) unsigned NOT NULL default '0',
bytes_xfer_avail int(10) unsigned NOT NULL default '0',
files_in_avail int(10) unsigned NOT NULL default '0',
files_out_avail int(10) unsigned NOT NULL default '0',
files_xfer_avail int(10) unsigned NOT NULL default '0'
) TYPE=MyISAM;
# --------------------------------------------------------
#
# Table structure for table `ftpquotatallies`
#
CREATE TABLE ftpquotatallies (
name varchar(30) NOT NULL default '',
quota_type enum('user','group','class','all') NOT NULL default 'user',
bytes_in_used int(10) unsigned NOT NULL default '0',
bytes_out_used int(10) unsigned NOT NULL default '0',
bytes_xfer_used int(10) unsigned NOT NULL default '0',
files_in_used int(10) unsigned NOT NULL default '0',
files_out_used int(10) unsigned NOT NULL default '0',
files_xfer_used int(10) unsigned NOT NULL default '0'
) TYPE=MyISAM;
#
# Table structure for table `ftpquotatallies`
#
CREATE TABLE `ftpquotatallies` (
`name` varchar(30) NOT NULL default '',
`quota_type` enum('user','group','class','all') NOT NULL default 'user',
`bytes_in_used` float NOT NULL default '0',
`bytes_out_used` float NOT NULL default '0',
`bytes_xfer_used` float NOT NULL default '0',
`files_in_used` int(10) unsigned NOT NULL default '0',
`files_out_used` int(10) unsigned NOT NULL default '0',
`files_xfer_used` int(10) unsigned NOT NULL default '0'
) TYPE=MyISAM;
# --------------------------------------------------------
#
# Table structure for table `ftpuser`
#
CREATE TABLE ftpuser (
id int(10) unsigned NOT NULL auto_increment,
userid varchar(32) NOT NULL default '',
passwd varchar(32) NOT NULL default '',
uid smallint(6) NOT NULL default '5500',
gid smallint(6) NOT NULL default '5500',
homedir varchar(255) NOT NULL default '',
shell varchar(16) NOT NULL default '/sbin/nologin',
count int(11) NOT NULL default '0',
accessed datetime NOT NULL default '0000-00-00 00:00:00',
modified datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (id),
UNIQUE KEY userid (userid)
) TYPE=MyISAM COMMENT='ProFTP user table';
INSERT INTO `ftpuser` VALUES (1, 'testaccount', 'ftppasswd', 5500, 5500, '/home/testdomain.com', '/sbin/nologin',0,'','');
exit;
Notes:
* The group table lists the members of each group. This does not need any records for a simple setup.
* The user table lists each of your ftp users and records their stats and is used for authentication and pointing proftpd to the correct
home directory. Using the directive 'asdfasf' we make proftpd create the home directory if one does not already exist.
* The quotalimits table is used to se the current quota for the user matching its entry.
* The quotatallies table is used by proftpd to keep track of the user's quotas and will be filled if there is a matching userfield 'name'
when a user logs in.
* We have added a user test account just called "testaccount" to check things are working ok.
Field Explanations:
quotalimits
name - username
quota_type - user, group, class, all (we use user)
per_session - true or false (we use true)
limit_type - quota limit type - hard or soft (we use hard)
bytes_in_avail - upload limit in bytes - allowed bytes on disk (eg diskquota)
bytes_out_avail - download limit in bytes - allowed bytes a user can download
bytes_xfer_avail - allowed bytes a user can transfer in/out
files_in_avail - upload limit in files - allowed number of uploaded files
files_out_avail - allowed number of downloaded files
files_xfer_avail - allowed number of files a user can transfer in/out
quotatallies
name
quota_type
bytes_in_used - upload tally in bytes
bytes_out_used - download tally in bytes
bytes_xfer_used - transfer tally in bytes
files_in_used - upload tally in files
files_out_used - download tally in files
files_xfer_used - transfer tally in files
If a value of any limit field is set to '0' it is unlimited.
You can read the documentation that comes with mod_quotatab for mysql here.
Author's Note:
You can test a 15MB quota limit on 'testaccount' by inserting this record into 'quotalimits':
INSERT INTO quotalimits VALUES('testaccount','user','true','hard','15728640','0','0','0','0','0');
I think you have to log in with this record in place before it works. It also will allow you to upload, but then deletes the file if you are
over the limit. This is a bit irritating because on normal user disk quotas, you get a message as you try to upload, not after. So you
might get some unhappy users who don't know why they can't upload. Also the message that you have exceeded the limit appears in
the ftp client transcript and your users will miss this if they don't show transcripts.
On a related note, I can seem to get any joy out of the quotatallies stuff. When I get more time, I may investigate this. In the
meantime, if any of you find out what is going on there, it would be cool if you leave a note in the forum here - then everyone can
benefit.
Proftpd Config File
Here is our complete configuration file setup with MySQL and quota support. Keep a copy of the installation one in /usr/local/etc/ and
replace with one like this - change to suit your ServerName and ServerAdmin and MySQL database login details.
ServerName "Khoosys Proftpd Server"
ServerType Standalone
ServerAdmin stephen@khoosys.net
# Hide as much as possible to outside users
ServerIdent on "Welcome to the Khoosys FTP server. Please login..."
DeferWelcome on
DefaultServer on
# Allow FTP resuming.
# Remember to set to off if you have an incoming ftp for upload.
AllowStoreRestart on
# Port 21 is the standard FTP port.
Port 21
# Umask 022 is a good standard umask to prevent new dirs and files
# from being group and world writable.
Umask 022
# To prevent DoS attacks, set the maximum number of child processes
# to 30. If you need to allow more than 30 concurrent connections
# at once, simply increase this value. Note that this ONLY works
# in standalone mode, in inetd mode you should use an inetd server
# that allows you to limit maximum number of processes per service
# (such as xinetd).
MaxInstances 30
# Set the user and group under which the server will run.
User nobody
Group nogroup
# To cause every FTP user to be "jailed" (chrooted) into their home
# directory, uncomment this line.
DefaultRoot ~
# Normally, we want files to be overwriteable.
AllowOverwrite on
# The passwords in MySQL are encrypted using CRYPT
SQLAuthTypes Plaintext Crypt
SQLAuthenticate users* groups*
# used to connect to the database
# databasename@host database_user user_password
SQLConnectInfo ftpdb@localhost proftpd password
# Here we tell ProFTPd the names of the database columns in the "usertable"
# we want it to interact with. Match the names with those in the db
SQLUserInfo ftpuser userid passwd uid gid homedir shell
# Here we tell ProFTPd the names of the database columns in the "grouptable"
# we want it to interact with. Again the names match with those in the db
SQLGroupInfo ftpgroup groupname gid members
# set min UID and GID - otherwise these are 999 each
SQLMinID 500
# create a user's home directory on demand if it doesn't exist
SQLHomedirOnDemand on
# Update count every time user logs in
SQLLog PASS updatecount
SQLNamedQuery updatecount UPDATE "count=count+1, accessed=now() WHERE userid='%u'" ftpuser
# Update modified everytime user uploads or deletes a file
SQLLog STOR,DELE modified
SQLNamedQuery modified UPDATE "modified=now() WHERE userid='%u'" ftpuser
# User quotas
# ===========
QuotaEngine on
QuotaDirectoryTally on
QuotaDisplayUnits Mb
QuotaShowQuotas on
SQLNamedQuery get-quota-limit SELECT "name, quota_type, per_session, limit_type, bytes_in_avail, bytes_out_avail,
bytes_xfer_avail, files_in_avail, files_out_avail, files_xfer_avail FROM ftpquotalimits WHERE name = '%{0}' AND quota_type = '%{1}'"
SQLNamedQuery get-quota-tally SELECT "name, quota_type, bytes_in_used, bytes_out_used, bytes_xfer_used, files_in_used,
files_out_used, files_xfer_used FROM ftpquotatallies WHERE name = '%{0}' AND quota_type = '%{1}'"
SQLNamedQuery update-quota-tally UPDATE "bytes_in_used = bytes_in_used + %{0}, bytes_out_used = bytes_out_used + %{1},
bytes_xfer_used = bytes_xfer_used + %{2}, files_in_used = files_in_used + %{3}, files_out_used = files_out_used + %{4},
files_xfer_used = files_xfer_used + %{5} WHERE name = '%{6}' AND quota_type = '%{7}'" ftpquotatallies
SQLNamedQuery insert-quota-tally INSERT "%{0}, %{1}, %{2}, %{3}, %{4}, %{5}, %{6}, %{7}" ftpquotatallies
QuotaLimitTable sql:/get-quota-limit
QuotaTallyTable sql:/get-quota-tally/update-quota-tally/insert-quota-tally
RootLogin off
RequireValidShell off
Proftpd startup file
As you can see we start proftpd as a standalone process and not as an xinetd service. We use the proftpd startup script provided by
the rpm distribution. You can download it here.
Testing
Start the service using /etc/rc.d/init.d/proftpd and login to the ftp server using 'testaccount' and 'ftppasswd'.
If the home directory '/home/testdomain.com' does not already exist it will be created.
Have fun!!
A few useful tips
If you want to check that queries are coming through to MySQL, turn on logging by adding a line to your MySQL configuration file such
as: log=/var/lib/mysql/mysql.log
Remember to turn off logging when you are done as it will slow things down with it on!
(Note that the MySQL config file is usually '/etc/my.cnf'. If you don't have one MySQL usually provides a set which you can copy
according to the size of server you want to run. For example, a huge server can use : '/usr/share/mysql/my-huge.cnf')
Useful links
* http//www.castaglia.org/proftpd/doc/contrib/ProFTPD-mini-HOWTO-SQL.html
* http//www.lastditcheffort.org/aah/proftpd/mod_sql/
๑๑/๑๔/๒๕๕๒
Disable Autorun.inf run on any medium
Earlier we saw how to remove a AutoRun Virus that abuse the autorun.inf file, to spread itself.Now, let us see how to turn off AutoRun.inf and thus protect your PC from AutoRun viruses and malwares.Windows had a bug in the way it handled AutoRun related Registry entries. When AutoRun is disabled, Windows operating system should not go past the Registry check. However, Windows continued to parse autorun.inf found on the removable media and did everything except the final action to invoke AutoPlay or execute an application.
How to Disable AutoRun.inf?
Nick Brown came up with a solution to prevent AUTORUN.INF files from being used on a PC, from any medium. This method involved using an initialisation file mapping, to create a mapping between the AUTORUN.INF initialisation file and the Registry. IniFileMapping is a key which tells Windows how to handle the .INI files which those applications typically used to store their configuration data (before the registry existed).This procedure relied on the fact that an autorun.inf file is a standard Windows INI file and so the appropriate API calls are used by Windows, when fetching its settings. These API calls can be redirected using the INI file mapping method. In this case, it says “whenever you have to handle a file called AUTORUN.INF, don’t use the values from the file. You’ll find alternative values at HKEY_LOCAL_MACHINE\SOFTWARE\DoesNotExist.” So how is this done?
Create a Registry file with the following contents and save it as DISABLEAUTORUN.REG.
Double click DISABLEAUTORUN.REG to make the relevant changes to Windows Registry. Now whenever Windows tries to read a file called “autorun.inf” using the INI programming calls, it is forbidden from reading from the actual file. Instead, all settings are read from the HKEY_LOCAL_MACHINE\Software\DoesNotExist Registry key. As this key does not exist, it is as if the autorun.inf file contains no settings information. This applies to any autorun.inf in any location and on any drive.
The only drawback with this approach is you need to manually trigger the setup program in any inserted CD or USB Stick. But isn’t it better to live with this than with AutoRun viruses?
credit: http://techblissonline.com/disable-autorun/
How to Disable AutoRun.inf?
Nick Brown came up with a solution to prevent AUTORUN.INF files from being used on a PC, from any medium. This method involved using an initialisation file mapping, to create a mapping between the AUTORUN.INF initialisation file and the Registry. IniFileMapping is a key which tells Windows how to handle the .INI files which those applications typically used to store their configuration data (before the registry existed).This procedure relied on the fact that an autorun.inf file is a standard Windows INI file and so the appropriate API calls are used by Windows, when fetching its settings. These API calls can be redirected using the INI file mapping method. In this case, it says “whenever you have to handle a file called AUTORUN.INF, don’t use the values from the file. You’ll find alternative values at HKEY_LOCAL_MACHINE\SOFTWARE\DoesNotExist.” So how is this done?
Create a Registry file with the following contents and save it as DISABLEAUTORUN.REG.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\IniFileMapping\Autorun.inf]
@="@SYS:DoesNotExist"
Double click DISABLEAUTORUN.REG to make the relevant changes to Windows Registry. Now whenever Windows tries to read a file called “autorun.inf” using the INI programming calls, it is forbidden from reading from the actual file. Instead, all settings are read from the HKEY_LOCAL_MACHINE\Software\DoesNotExist Registry key. As this key does not exist, it is as if the autorun.inf file contains no settings information. This applies to any autorun.inf in any location and on any drive.
The only drawback with this approach is you need to manually trigger the setup program in any inserted CD or USB Stick. But isn’t it better to live with this than with AutoRun viruses?
credit: http://techblissonline.com/disable-autorun/
๑๑/๑๒/๒๕๕๒
mythtv Open source PVR
http://www.mythtv.org/
http://www.pvrweb.com/
##
Ubuntu 9.10
sudo apt-get build-dep mythtv
http://www.pvrweb.com/
##
Ubuntu 9.10
sudo apt-get build-dep mythtv
๑๑/๐๕/๒๕๕๒
software raid url
http://slacksite.com/slackware/raid.html
using mdadm new raidtool
http://linuxdevcenter.com/pub/a/linux/2002/12/05/RAID.html
using mdadm new raidtool
http://linuxdevcenter.com/pub/a/linux/2002/12/05/RAID.html
๑๐/๒๘/๒๕๕๒
Install Slackware Hardware RAID SCSI CDROM
My system: Dell Poweredge 4300, 2x-PII-350's, 6-4.3gb raided with the Dell/AMI MegaRAID II card, Floppy and SCSI CD-ROM on the second Adaptec embedded UW controller on the MOBO. This should work for other types of SCSI Raid cards (If supported by the raid.s kernel) and Adaptec controlled SCSI-CD-Rom drives.
Here are the steps:
A. Do a Google search for "kernel-modules-2.4.22-i486-2" download
the .gz from one of the "hits".
B. Un-tar and save module aic7xxx.o to a floppy. You will need this later in step "5" below.
1. Boot your system and enable your CD-ROM device as bootable in the
SCSI Bios setup.
2. Boot up your Slackware 9.1 Install CD-I (You did download an burn them
from the ISO's right?)
3. Select kernel image "raid.s" this will allow recognition of your SCSI drives.
4. Log in as "root"...
5. Insert the floppy with aic7xxx.o on it into your floppy drive.
6. Do "mount /mnt/fd0 /mnt"
7. cd to /mnt
8. Do "insmod aic7xxx.o" (this sets up the adaptec SCSI support in the
kernel
insmod - "install loadable module").
9. Run "setup" normally, select your mount points, etc. (I'm presuming you
have run fdisk or cfdisk
).
10. Select your "source" as CD-ROM and allow setup to search for it...
11. VIOLA!! Slackware "sees" your CD-Rom drive running on the Adaptec
controller and your RAID drives are still recognized!
12. Continue with the installation normally!
enj
Here are the steps:
A. Do a Google search for "kernel-modules-2.4.22-i486-2" download
the .gz from one of the "hits".
B. Un-tar and save module aic7xxx.o to a floppy. You will need this later in step "5" below.
1. Boot your system and enable your CD-ROM device as bootable in the
SCSI Bios setup.
2. Boot up your Slackware 9.1 Install CD-I (You did download an burn them
from the ISO's right?)
3. Select kernel image "raid.s" this will allow recognition of your SCSI drives.
4. Log in as "root"...
5. Insert the floppy with aic7xxx.o on it into your floppy drive.
6. Do "mount /mnt/fd0 /mnt"
7. cd to /mnt
8. Do "insmod aic7xxx.o" (this sets up the adaptec SCSI support in the
kernel
9. Run "setup" normally, select your mount points, etc. (I'm presuming you
have run fdisk or cfdisk
10. Select your "source" as CD-ROM and allow setup to search for it...
11. VIOLA!! Slackware "sees" your CD-Rom drive running on the Adaptec
controller and your RAID drives are still recognized!
12. Continue with the installation normally!
enj
Slackware 9.1 & 10.1 on software raid-1
Slackware 9.1 & 10.1 on software raid-1 : HOWTO
6th May 2006, version 1.5© David Fletcher
The original of this document can be found at: www.megapico.co.uk/linuxdocs/slackware_raid.html
If you have updates or suggestions for this document, please send them to "linuxdocs at megapico dot co dot uk"
Latest updates are at the bottom
HOWTO!
Installing Slackware with software raid-1 is surprisingly easy to do - once you know how! Although the installer doesn't do everything for you like some other distributions, there are only a few extra steps required relative to a standard Slackware install.I assume that you have two identical ide hard drives, one each on the primary and secondary controllers. I'll also assume that you don't have any data you want to keep on these drives, and that you are installing using a Slackware CD.
The steps are:
- Boot from the install cd. I found the "bare.i" kernel did everything I needed
- Log in as root and use fdisk to partition both drives in exactly the same way. Set all the partitions to type "fd" (linux raid auto-detect) except for any extended partitions, which should be left as type "linux extended".
Set the active or bootable partition on both drives to whichever partition contacts /boot.
- Create the file /etc/raidtab using vi, or copy it in from a floppy or CD (see below). Typical contents of this file are:
raiddev /dev/md0 raid-level 1 chunk-size 64k persistent-superblock 1 nr-raid-disks 2 device /dev/hda1 raid-disk 0 device /dev/hdb1 raid-disk 1 raiddev /dev/md1 raid-level 1 chunk-size 64k persistent-superblock 1 nr-raid-disks 2 device /dev/hda5 raid-disk 0 device /dev/hdb5 raid-disk 1
for as many raid devices as you want to create. - Ensure there are enough raid device files in /dev. Four are present by default, but you can create more using
mknod /dev/md4 b 9 4 mknod /dev/md5 b 9 5
etc. - Start the first raid device using
mkraid /dev/md0
and repeat for the higher numbered ones. If you have data on the discs which you want to keep, ensure it is on the first disc of each pair as defined in /etc/raidtab. If you need to, try --really-force to wipe filesystems on the second drive of each pair. - Check progress by looking at /proc/mdstat using "more".
- Copy /etc/raditab to a floppy now. You will loose it if you switch off at this stage since it is on a ram drive.
- If you want to use tagfiles to set-up the system automatically (perhaps if setting up several identical systems) this can be done easily if you have a floppy which can be mounted to read the files. You can also copy in /etc/raidtab and /etc/lilo.conf if you have them already written (see above).
For a system without a floppy I found that a USB flash drive is not supported by the installation CD, but a CD with the required files can be mounted and read before typing "setup". If the CD is /dev/hdc use:
mount /dev/hdc /var/log/mount
and then copy the files you want. Remember that with the exception of directories below /mnt which are the hard drive partitions onto which the installation will take place, you are copying to a filesystem which exists only in RAM. Don't turn the machine off until the installation is completed! Finish off with
umount /dev/hdc
and put the installation CD back in the drive.
- You can now start "setup" as usual, but you will find it is slow if you don't wait for all the raid discs to finish synchronising.
- Go through setup as normal, but note that you can't set up a swap partition yet - you will get an error about not having partition marked as swap. Just ignore this and set up the swap partition later.
- When you are asked about setting up Lilo, choose "skip". You need to add some special lines to lilo.conf, which setup can't cope with.
- Exit setup, but don't reboot yet! First, copy /etc/raidtab to /mnt/etc/raidtab
- Also before rebooting, set up the swap partition. If you plan to use /dev/md1 for swap, type
mkswap -c /dev/md1
This includes checking for bad blocks, so it is quite slow. - To ensure swap works the next time you boot up, edit /mnt/etc/fstab to add this line:
/dev/md1 swap swap defaults 0 0
where /dev/md1 is the raid device on which you have set-up swap. - Now install lilo using a lilo.conf file of the type shown below. This file can be created with vi as /mnt/etc/lilo.conf. The example assumes that that the root of the filesystem is on /dev/md3, and that /boot is on /dev/md0, and that the two discs making up the raid are /dev/hda and /dev/hdc.
The "raid-extra-boot" line ensures that both discs of the raid pair have boot code placed on them, so if either fails the system should still boot. However, if the usual start-up disc is the one which fails, you might need to manually set the bios to boot from the remaining good disc.
boot = /dev/md0 raid-extra-boot="/dev/hda,/dev/hdc" timeout = 50 vga = normal image = /boot/vmlinuz root = /dev/md3 label = linux read-only
This needs to be installed using the lilo -r option because the filesystem which will be the root is mounted under /mnt during setup.lilo -r /mnt/ -C /etc/lilo.conf
An alternative that seems to work is just to copy the file you have edited from /mnt/etc/lilo.conf to /etc/lilo.conf and then run lilo without any options. To try out what lilo is going to do use options -t -v to do a test run without really writing to the disc. Any warnings likeWarning: dev/hdc is not on the first disk
can be ignored - they are just for information. - Now take out the setup cd and reboot. The system should start-up from the hard disc. You can check the raid devices by reading /proc/mdstat
Updates
- Steve Husted in West Sacramento, CA, USA contacted me to say that these instructions work on Slackware Current 23rd December 2004 (pretty much equates to Slackware 10.1) on a board with an Intel 865G chipset with 2 Maxtor SATA drives.
Steve also passed on some links to more information at:
http://www.oxnardcollege.edu/it/howto/slacksoftraid.asp
http://slacksite.com/slackware/raid.html
A complication of Serial ATA with the Slackware installation is that the 2.4 kernel series doesn't seem to support SATA as well as the 2.6, (e.g. the ICH5 I/O controller gets stuck in PIO mode) but the installation is currently designed to use the 2.4 kernel. As of Jan 2005 you need to decide if a post-install upgrade to the 2.6 series will be stable enough for you, otherwise use SCSI or traditional ATA hardware. If using SCSI, remember to replace the bare.i krenel image with adaptec.s, or whichever corresponds to your SCSI card.
Steve found out the hard way that while you can build a RAID 0, 1, 5, or span, you can't BOOT to anything but RAID1.
- Nick Coons from RedSeven Computer Co (http://www.red7usa.com) let me know on 28th Aug 2005 of a mistake in the lilo command line which is hopefully now correct, but things otherwise went well on Slackware 10.1. The lilo command previously read lilo -r /mnt/ /mnt/etc/lilo.conf
- Installation onto SCSI discs. I found a problem with installation into SCSI discs connected to the Adaptec AIC7892 controller in an IBM x330 server. I don't know if the problem is general to all SCSI controllers, but it is worth noting here.
Although the partition on which lilo was installed (/dev/sda1) was set 'active' using fdisk, and the SCSI bios was set to boot from the disc, the system would not boot. Installing lilo onto the Master Boot Record (MBR) rather than a partition of the drive solved the problem. This required using the line below in lilo.conf:
boot = /dev/sda
Some experiments with 'raid-extra-boot = mbr' might also be useful. I'll add details here which they are available.
Disclaimer
Neither the author nor the distributors, or any other contributor of this HOWTO are in any way responsible for physical, financial, moral or any other type of damage incurred by following the suggestions in this text.credit: http://www.megapico.co.uk/linuxdocs/slackware_raid.html
Slackware Creating The Boot Disk
Once you have selected a boot disk image file from the list below, you will need to create the disk. If you are creating the image from a Linux system, the following command should work just fine:
IDE bootdisks (.i suffix)
SCSI bootdisks (.s suffix)
dd if=[image file name] of=/dev/fd0You may need to change /dev/fd0 depending on your configuration. If you are creating the image from a DOS system, the included program RAWRITE will help you make the disk. Here is the syntax for RAWRITE:
C:\>RAWRITE [image file name] [destination drive letter]:For example, if I wanted to make a boot disk from the net.i image on a DOS system with the floppy drive as A:, I would use the following command.
C:\>RAWRITE bare.i a:You should now have a working boot disk to use during the Slackware Linux installation.
IDE bootdisks (.i suffix)
bare.i | This is the disk to use for installation on most IDE based PCs, with support for nearly all IDE controllers and support for IDE/ATAPI CD-ROM/DVD drives. Most CD-ROM drives made today fall into this category. |
bareacpi.i | This is similar to the bare.i bootdisk, but the kernel also contains support for ACPI (Advanced Configuration and Power Interface). If you aren't using a laptop, then you probably will not need ACPI (or APM) support. |
ataraid.i | This is a bootdisk with support for IDE RAID controllers. The install disks now have preliminary support for these controllers as well. The drivers included are: 3ware Hardware ATA-RAID controllers. Promise Fasttrak(tm) IDE RAID. Highpoint 370 software RAID. Many of these controllers will require some degree of do-it-yourself setup before and/or after installation. |
lowmem.i | This is a really stripped-down Linux kernel which might be useful for installing on IDE systems with a low amount of RAM (less than 8MB). It's also the only Slackware kernel that supports old 386 machines. If bare.i runs into problems, you might try this. NOTE: On systems with extremely low memory (4MB), ZipSlack plus the fourmeg.zip add-on (found in the zipslack directory) may boot and run even in cases where lowmem.i doesn't. If you have to use lowmem.i to install, you'll then probably have to compile a custom kernel with the minimal additional features that your machine requires. |
old_cd.i | This is a version of bare.i with additional support for old CD-ROM drives on non-standard proprietary interfaces. The CD-ROM drives supported by this bootdisk are: Aztech CDA268-01A, Orchid CD-3110, Okano/Wearnes CDD110, Conrad TXC, CyCDROM CR520, CR540. Sony CDU31/33a CD-ROM. Sony CDU531/535 CD-ROM. Philips/LMS cm206 CD-ROM with cm260 adapter card. Goldstar R420 CD-ROM (sometimes sold in a 'Reveal Multimedia Kit'). ISP16/MAD16/Mozart CD-ROM drives. NON-IDE Mitsumi CD-ROM support. Optics Storage 8000 AT CD-ROM (the 'DOLPHIN' drive). Sanyo CDR-H94A CD-ROM support. Matsushita, Kotobuki, Panasonic, CreativeLabs (Sound Blaster), Longshine and Teac NON-IDE CD-ROM support. |
pportide.i | This is an extended version of bare.i with support for a wide variety of parallel-port IDE devices. Supports parallel-port products from MicroSolutions, Hewlett-Packard, SyQuest, Imation, Avatar, and other manufacturers. |
sata.i | This is a version of bare.i with support for SATA controllers made by Promise, Silicon Image, SiS, ServerWorks / Apple K2, VIA, and Vitesse. |
SCSI bootdisks (.s suffix)
adaptec.s | This bootdisk supports most Adaptec SCSI controllers, including these models: AHA-1510, AHA-1520, AHA-1522, AHA-1522, AHA-1740, and AHA-2825. The AIC7xxx models, which include the 274x EISA cards; 284x VLB cards; 2902, 2910, 293x, 294x, 394x, 3985 and several other PCI and motherboard based SCSI controllers from Adaptec. Adaptec's I2O based RAID controllers (including OEM Adaptec RAID controllers used by HP and Dell, Adaptec branded AAC964/5400 RAID controllers, and DPT SmartRaid V cards) |
ibmmca.s | This is a bootdisk based on a development kernel which supports MicroChannel Architecture, found in some IBM PS/2 machines and laptops. It is a bus system similar to PCI or ISA. Support for most MCA SCSI, Ethernet, and Token Ring adapters is included. |
jfs.s | A version of bare.i with support for IBM's Journaled Filesystem as well as Adaptec AIC7xxx SCSI support. |
raid.s | This is a bootdisk with support for some hardware SCSI and ATA RAID controllers. The install disks now have preliminary support for these controllers as well. The drivers included are: AMI MegaRAID 418, 428, 438, 466, 762, 490 and 467 SCSI host adapters, Compaq Smart, Compaq Smart Array 5xxx, IBM ServeRAID hardware RAID, LSI Logic Fusion(TM) MPT devices (not really RAID, but added since there was room for this driver here), Mylex DAC960, AcceleRAID, and eXtremeRAID controllers. Many of these controllers will require some degree of do-it-yourself setup before and/or after installation. |
scsi.s | This is a SCSI bootdisk with support for various controllers. Note that this disk does not include Adaptec support any longer -- you must use the adaptec.s bootdisk for that. This disk supports these SCSI controllers: AM53/79C974 PCI SCSI, BusLogic SCSI, EATA ISA/EISA/PCI (DPT and generic EATA/DMA-compliant boards), Initio 91XXU(W) and Initio 91XXU(W), SYM53C8XX Version 2, Qlogic ISP SCSI, Qlogic QLA 1280 SCSI. |
scsi2.s | This is a SCSI bootdisk with support for various controllers. This disk supports these SCSI controllers: AdvanSys SCSI (supports all AdvanSys SCSI controllers, including some SCSI cards included with HP CD-R/RW drives, the Iomega Jaz Jet SCSI controller, and the SCSI controller on the Iomega Buz multimedia adapter), ACARD 870U/W SCSI host adapter, Compaq Fibre Channel 64-bit/66Mhz HBA, Domex DMX3191D SCSI Host Adapters, DTC 3180/3280 SCSI Host Adapters, Future Domain 16xx SCSI/AHA-2920A, NCR53c7, 8xx, NCR53C8XX |
scsi3.s | This is a SCSI bootdisk with support for various controllers. This disk supports these SCSI controllers: Western Digital 7000FASST SCSI support, Always IN2000, Intel/ICP (former GDT SCSI Disk Array) RAID Controller, PCI2000I, PCI2220i, PSI240i EIDE interface card, Qlogic FAS SCSI, QLogic ISP FC (ISP2100 SCSI-FCP), Seagate ST01/ST02, Future Domain TMC-885/950 SCSI, SYM53c416 SCSI host adapter, UltraStor 14F, 24F and 34F SCSI-2 host adapters, Workbit NinjaSCSI-32Bi/UDE |
speakup.s | This is like the bare.i (standard IDE) disk, but has support for Speakup (and since there was space, support for Adaptec's AIC7xxx SCSI controllers is also included) Speakup provides access to Linux for the visually impaired community. It does this by sending console output to a number of different hardware speech synthesizers. It provides access to Linux by making screen review functions available. For more information about speakup and its drivers check out: http://www.linux-speakup.org. To use this, you'll need to specify one of the supported synthesizers on the bootdisk's boot prompt: ramdisk speakup_synth=synth where 'synth' is one of the supported speech synthesizers: acntpc, acntsa, apolo, audptr, bns, decext, dectlk, dtlk, ltlk, spkout, txprt |
xfs.s | This is an extended version of bare.i with support for SGI's XFS filesystem. Support for Adaptec's AIC7xxx SCSI controllers is also included. |
Slackware 9.1 & 10.1 on software raid-1
Slackware 9.1 & 10.1 on software raid-1 : HOWTO
6th May 2006, version 1.5© David Fletcher
The original of this document can be found at: www.megapico.co.uk/linuxdocs/slackware_raid.html
If you have updates or suggestions for this document, please send them to "linuxdocs at megapico dot co dot uk"
Latest updates are at the bottom
HOWTO!
Installing Slackware with software raid-1 is surprisingly easy to do - once you know how! Although the installer doesn't do everything for you like some other distributions, there are only a few extra steps required relative to a standard Slackware install.I assume that you have two identical ide hard drives, one each on the primary and secondary controllers. I'll also assume that you don't have any data you want to keep on these drives, and that you are installing using a Slackware CD.
The steps are:
- Boot from the install cd. I found the "bare.i" kernel did everything I needed
- Log in as root and use fdisk to partition both drives in exactly the same way. Set all the partitions to type "fd" (linux raid auto-detect) except for any extended partitions, which should be left as type "linux extended".
Set the active or bootable partition on both drives to whichever partition contacts /boot.
- Create the file /etc/raidtab using vi, or copy it in from a floppy or CD (see below). Typical contents of this file are:
raiddev /dev/md0 raid-level 1 chunk-size 64k persistent-superblock 1 nr-raid-disks 2 device /dev/hda1 raid-disk 0 device /dev/hdb1 raid-disk 1 raiddev /dev/md1 raid-level 1 chunk-size 64k persistent-superblock 1 nr-raid-disks 2 device /dev/hda5 raid-disk 0 device /dev/hdb5 raid-disk 1
for as many raid devices as you want to create.
- Ensure there are enough raid device files in /dev. Four are present by default, but you can create more using
mknod /dev/md4 b 9 4 mknod /dev/md5 b 9 5
etc.
- Start the first raid device using
mkraid /dev/md0
and repeat for the higher numbered ones. If you have data on the discs which you want to keep, ensure it is on the first disc of each pair as defined in /etc/raidtab. If you need to, try --really-force to wipe filesystems on the second drive of each pair.
- Check progress by looking at /proc/mdstat using "more".
- Copy /etc/raditab to a floppy now. You will loose it if you switch off at this stage since it is on a ram drive.
- If you want to use tagfiles to set-up the system automatically (perhaps if setting up several identical systems) this can be done easily if you have a floppy which can be mounted to read the files. You can also copy in /etc/raidtab and /etc/lilo.conf if you have them already written (see above).
For a system without a floppy I found that a USB flash drive is not supported by the installation CD, but a CD with the required files can be mounted and read before typing "setup". If the CD is /dev/hdc use:
mount /dev/hdc /var/log/mount
and then copy the files you want. Remember that with the exception of directories below /mnt which are the hard drive partitions onto which the installation will take place, you are copying to a filesystem which exists only in RAM. Don't turn the machine off until the installation is completed! Finish off with
umount /dev/hdc
and put the installation CD back in the drive.
- You can now start "setup" as usual, but you will find it is slow if you don't wait for all the raid discs to finish synchronising.
- Go through setup as normal, but note that you can't set up a swap partition yet - you will get an error about not having partition marked as swap. Just ignore this and set up the swap partition later.
- When you are asked about setting up Lilo, choose "skip". You need to add some special lines to lilo.conf, which setup can't cope with.
- Exit setup, but don't reboot yet! First, copy /etc/raidtab to /mnt/etc/raidtab
- Also before rebooting, set up the swap partition. If you plan to use /dev/md1 for swap, type
mkswap -c /dev/md1
This includes checking for bad blocks, so it is quite slow.
- To ensure swap works the next time you boot up, edit /mnt/etc/fstab to add this line:
/dev/md1 swap swap defaults 0 0
where /dev/md1 is the raid device on which you have set-up swap.
- Now install lilo using a lilo.conf file of the type shown below. This file can be created with vi as /mnt/etc/lilo.conf. The example assumes that that the root of the filesystem is on /dev/md3, and that /boot is on /dev/md0, and that the two discs making up the raid are /dev/hda and /dev/hdc.
The "raid-extra-boot" line ensures that both discs of the raid pair have boot code placed on them, so if either fails the system should still boot. However, if the usual start-up disc is the one which fails, you might need to manually set the bios to boot from the remaining good disc.
boot = /dev/md0 raid-extra-boot="/dev/hda,/dev/hdc" timeout = 50 vga = normal image = /boot/vmlinuz root = /dev/md3 label = linux read-only
This needs to be installed using the lilo -r option because the filesystem which will be the root is mounted under /mnt during setup.
lilo -r /mnt/ -C /etc/lilo.conf
An alternative that seems to work is just to copy the file you have edited from /mnt/etc/lilo.conf to /etc/lilo.conf and then run lilo without any options. To try out what lilo is going to do use options -t -v to do a test run without really writing to the disc. Any warnings like
Warning: dev/hdc is not on the first disk
can be ignored - they are just for information.
- Now take out the setup cd and reboot. The system should start-up from the hard disc. You can check the raid devices by reading /proc/mdstat
Updates
- Steve Husted in West Sacramento, CA, USA contacted me to say that these instructions work on Slackware Current 23rd December 2004 (pretty much equates to Slackware 10.1) on a board with an Intel 865G chipset with 2 Maxtor SATA drives.
Steve also passed on some links to more information at:
http://www.oxnardcollege.edu/it/howto/slacksoftraid.asp
http://slacksite.com/slackware/raid.html
A complication of Serial ATA with the Slackware installation is that the 2.4 kernel series doesn't seem to support SATA as well as the 2.6, (e.g. the ICH5 I/O controller gets stuck in PIO mode) but the installation is currently designed to use the 2.4 kernel. As of Jan 2005 you need to decide if a post-install upgrade to the 2.6 series will be stable enough for you, otherwise use SCSI or traditional ATA hardware. If using SCSI, remember to replace the bare.i krenel image with adaptec.s, or whichever corresponds to your SCSI card.
Steve found out the hard way that while you can build a RAID 0, 1, 5, or span, you can't BOOT to anything but RAID1.
- Nick Coons from RedSeven Computer Co (http://www.red7usa.com) let me know on 28th Aug 2005 of a mistake in the lilo command line which is hopefully now correct, but things otherwise went well on Slackware 10.1. The lilo command previously read lilo -r /mnt/ /mnt/etc/lilo.conf
- Installation onto SCSI discs. I found a problem with installation into SCSI discs connected to the Adaptec AIC7892 controller in an IBM x330 server. I don't know if the problem is general to all SCSI controllers, but it is worth noting here.
Although the partition on which lilo was installed (/dev/sda1) was set 'active' using fdisk, and the SCSI bios was set to boot from the disc, the system would not boot. Installing lilo onto the Master Boot Record (MBR) rather than a partition of the drive solved the problem. This required using the line below in lilo.conf:
boot = /dev/sda
Some experiments with 'raid-extra-boot = mbr' might also be useful. I'll add details here which they are available.
Disclaimer
Neither the author nor the distributors, or any other contributor of this HOWTO are in any way responsible for physical, financial, moral or any other type of damage incurred by following the suggestions in this text.Get if from: http://www.megapico.co.uk/linuxdocs/slackware_raid.html
INSTALLING SLACKWARE LINUX version 8.1 WITH ROOT PARTITION ON A SOFTWARE RAID level 0 DEVICE.
INSTALLING SLACKWARE LINUX version 8.1 WITH ROOT PARTITION ON A SOFTWARE RAID level 0 DEVICE. 20021009 v 1.0.1 Copyright (c) 2002 Karl Magnus Kolst๘. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license can be found here; http://www.gnu.org/licenses/fdl.txt If you screw up something (like your data and/or your hardware) while using this document it is your fault, not mine. You should know what you are doing. Reading some documentation on software RAID is highly recommended. (I.e the Software-RAID-HOWTO; http://www.tldp.org/HOWTO/Software-RAID-HOWTO.html ) Document History: v 1.0.1 20021009 Fix up the wording of a couple of sentences. v 1.0 20020913 Initial release. This document is a small write-up on how I did install Slackware 8.1 on a software raid 0, aka striping. Note that this document does not cover troubleshooting, only the exact steps that should be nessesary to put Slack 8.1 on / At least they where the steps I had to do to make it work. This write-up should be usable for setting up software raid level 4 or 5 on Slackware too (with some tweaking). As for raid level 1 the configuration should be similar too, but different enought to say that this write-up doesn't cover it. My disk setup was 7 disks on one SCSI channel. (yes, I _know_ you shouldn't have that many drives on one channel :) The computer could boot from those drives. First I booted from the Slackware 8.1 CD. Had to use kernel scsi.s because of my scsi setup. At the prompt I started partitioning the drives with fdisk. All my drives where identical, so I decided to partition them identically. Partition 1 on each disk I put a 15MB partition. Partition 2 on each disk I put the partition to be raided. Partition 4 on each disk I put a swap partition. (Why 4 and not 3? Just a personal convention. I always put swap on the forth primary partition on a disk.) Then I set partition types 83, FD and 82 respectively. Why that 15MB partition? Linux can't boot the kernel directly off of a software raided partition (raid1 is another story) so it needs a partition to get the kernel from which is not a part of a raid set. That first partition on first drive (/dev/sda1 in my case) I wanted to mount under /boot. But why waste disk space? I ended up setting up first partition on all the other drives to type 82 (linux swap). That way I ended up with 13(!) swap partitions. A better way would probably be to set up the raid partitions on the end of the drive and make a larger swap partition on the beginning of each drive. But then take 10-20MB of the the swap partition on the first drive and use that for /boot. Anyway I now have 7 drives partitioned the way I want. First I must configure the raid. Check if /dev/md0 exists. (like 'ls -l /dev/md0') If it doesn't exist, create it; mknod /dev/md0 b 9 0 I created a /etc/raidtab which looked like this; -------- cut --------- raiddev /dev/md0 raid-level 0 nr-raid-disks 7 nr-spare-disks 0 chunk-size 32 persistent-superblock 1 device /dev/sda2 raid-disk 0 device /dev/sdb2 raid-disk 1 device /dev/sdc2 raid-disk 2 device /dev/sdd2 raid-disk 3 device /dev/sde2 raid-disk 4 device /dev/sdf2 raid-disk 5 device /dev/sdg2 raid-disk 6 -------- cut --------- Then we need to start the raid set; mkraid /dev/md0 (if you have an already started set you must stop that and restart with option --force. (read the instructions)) Now it's time to create a filesystem on the "new" device. mke2fs -j -c -b 4096 -R stride=8 /dev/md0 I want ext3 (-j) I want to check the filesystem (-c) I want 4k block size (-b 4096, which is default by the way) and I want to tell the formatting tool something about my raid chunk size. Calculate it this way; stride = chunk-size / block-size (all values in kilobytes) For me the calculation is; 32 / 4 = 8 I must not forget to format the partition which is going to be /boot mke2fs -j -c /dev/sda1 Instead of letting the Slackware setup mount the partitions I do it myself. (the setup is *not* aware of raid devices anyway, so this needs to be done manually.) mount /dev/md0 /mnt mkdir /mnt/boot mount /dev/sda1 /mnt/boot Then we can run 'setup' Do a regular install, but be sure to *not* add any partitions to install on. Just choose; "--- (done adding partitions, continue with setup" I also chose simple lilo install on mbr. When the install is done, exit 'setup' and do the following; cp /etc/raidtab /mnt/etc/raidtab edit /mnt/etc/fstab and add; /dev/md0 / ext3 defaults 1 1 /dev/sda1 /boot ext3 defaults 1 2 edit /mnt/etc/lilo.conf be sure that; root = /dev/fd2 gets changed to; root = /dev/md0 Then run lilo -C /mnt/etc/lilo.conf Now you should be able to boot the machine with / on a RAID 0 device. When trying to follow my own write-up I had the following problem when trying to boot up the newly installed Slackware. (This happend once of the 4 times I tested.) For every partition I got; md: /dev/sda2's has invalid sb, not importing! (Or a similar error message, at that point I didn't take notes, sorry.) The computer halted with a Kernel Panic during boot. I then booted from the CD again, created /etc/raidtab again (equal to the first one), and reran mkraid /dev/md0. After that I could mount /dev/md0, and everything looked ok there. Slackware was installed. I did reboot, and everything came up as it should. I still wonder if I followed this write-up to the letter or if something strange happened. Suggestions and error corrections are welcome. Karl Magnus Kolst๘ karl.kolsto@geo.uib.no Thanks to John Jenkins and Erik Jan Tromp for looking through this doc and comming with suggestions. # end of file Get it from : http://userlocal.com/articles/raid0-slackware-linux.php
tune2fs
NAME
tune2fs - adjust tunable filesystem parameters on ext2/ext3 fi
lesystems
SYNOPSIS
tune2fs [ -l ] [ -c max-mount-counts ] [ -e errors-behavior ]
[ -f ] [
-i interval-between-checks ] [ -j ] [ -J journal-optio
ns ] [ -m
reserved-blocks-percentage ] [ -o [^]mount-options[,...]
] [ -r
reserved-blocks-count ] [ -s sparse-super-flag ] [ -u user ] [
-g group
] [ -C mount-count ] [ -E extended-options ] [ -L volume-name
] [ -M
last-mounted-directory ] [ -O [^]feature[,...] ] [ -T t
ime-last-
checked ] [ -U UUID ] device
DESCRIPTION
tune2fs allows the system administrator to adjust various
tunable
filesystem parameters on Linux ext2/ext3 filesystems.
tune2fs - adjust tunable filesystem parameters on ext2/ext3 fi
lesystems
SYNOPSIS
tune2fs [ -l ] [ -c max-mount-counts ] [ -e errors-behavior ]
[ -f ] [
-i interval-between-checks ] [ -j ] [ -J journal-optio
ns ] [ -m
reserved-blocks-percentage ] [ -o [^]mount-options[,...]
] [ -r
reserved-blocks-count ] [ -s sparse-super-flag ] [ -u user ] [
-g group
] [ -C mount-count ] [ -E extended-options ] [ -L volume-name
] [ -M
last-mounted-directory ] [ -O [^]feature[,...] ] [ -T t
ime-last-
checked ] [ -U UUID ] device
DESCRIPTION
tune2fs allows the system administrator to adjust various
tunable
filesystem parameters on Linux ext2/ext3 filesystems.
๑๐/๒๑/๒๕๕๒
เรียกใช้ตัวอักษรหรือตัวอักขระพิเศษด้วยปุ่ม Alt
เรียกใช้ตัวอักษรหรือตัวอักขระพิเศษด้วยปุ่ม Alt
เคย เห็นไหมครับ ว่าเวลาที่คุย IM ไม่ว่าจะเป็น MSN, Live Messenger, Skype, Goolgle Talk, Yahoo Messenger หรือโปรแกรมสนทนาออนไลน์อื่นๆ เราจะเห็นว่าบางคนหรือคู่สนทนาของเราพิมพ์สัญลักษณ์ต ัวอักษร หรือตัวอักขระพิเศษๆ แปลกๆส่งมา หรือแม้กระทั่งตกแต่งเว็บ Social หรือบล็อกต่างๆ เช่น Facebook, Myspace, Hi5, Exteen, Bloggang เป็นต้น แล้วเราจะเรียกใช้ตัวอักษรหรือตัวอักขระพิเศษเหล่านั ้นได้อย่างไร?
วันนี้ผมจะมาแนะนำวิธีเรียกใช้งานตัวอักษร หรือตัวอักขระพิเศษเหล่านั้นด้วยปุ่ม Alt คีย์ ซึ่งมีวิธีการดังต่อไปนี้
วิธี การ ก็คือ ให้กดปุ่ม Alt คีย์ค้างไว้ ตามด้วยกดปุ่มตัวเลข 4 หลักบนคีย์บอร์ด เมื่อกดปุ่มตัวเลข 4 หลักบนคีย์บอร์ดที่ต้องการเรียบร้อยแล้ว ให้ปล่อยปุ่ม Alt คีย์ที่กดค้างไว้ จากนั้นคุณก็จะเห็นตัวอักษร หรือตัวอักขระพิเศษ ปรากฏขึ้นมาแล้วหล่ะครับ
นอก จากนี้ คุณยังสามารถใช้โปรแกรม Character Map Utility ซึ่งเป็นยูทิลิตีฟรีตัวหนึ่งที่มาพร้อมกับวินโดวส์ ซึ่งคุณสามารถคัดลอก และวางตัวอักษรหรือตัวอักขระพิเศษเหล่านั้น เพื่อนำไปใช้งานในโปรแกรมอื่นๆได้ เช่น Microsoft Word, Microsoft Frontpage หรือโปรแกรมอื่นๆ เป็นต้น ซึ่งวิธีการเรียกใช้ Character Map Utility ทำได้ดังนี้
1. ให้ไป Start > Programs > Accessories > System Tools > Character Map
2. หรือไปที่ Start > Run > จากนั้นพิมพ์ว่า Charmap แล้ว OK หรือกดปุ่ม Enter
3. หลังจากที่เปิดโปรแกรมขึ้นมาเรียบร้อยแล้ว ให้เลือกรูปแบบตัวอักษร แล้วคลิกที่ตัวอักษรพิเศษที่คุณต้องการ จากนั้นก็คลิก Copy แล้วเอาไปวางในโปรแกรมที่คุณต้องการ
เห็นไหมหล่ะครับ วิธีการง่ายๆเพียงเท่านี้ คุณก็จะสามารถใช้งานตัวอักษรหรือตัวอักขระพิเศษได้แล ้วหล่ะครับ
เครดิต:Webmonster
ที่มา http://webmonster.sapaan.net/archives/90#comment-282
หรือจะลองดูตารางอันนี้ประกอบด้วยได้ครับ
Special Characters — Alt Keyboard Sequences
ที่มา http://tools.oratory.com/altcodes.html
เอามาจาก: http://www.thaigaming.com/articles/49378.htm
เคย เห็นไหมครับ ว่าเวลาที่คุย IM ไม่ว่าจะเป็น MSN, Live Messenger, Skype, Goolgle Talk, Yahoo Messenger หรือโปรแกรมสนทนาออนไลน์อื่นๆ เราจะเห็นว่าบางคนหรือคู่สนทนาของเราพิมพ์สัญลักษณ์ต ัวอักษร หรือตัวอักขระพิเศษๆ แปลกๆส่งมา หรือแม้กระทั่งตกแต่งเว็บ Social หรือบล็อกต่างๆ เช่น Facebook, Myspace, Hi5, Exteen, Bloggang เป็นต้น แล้วเราจะเรียกใช้ตัวอักษรหรือตัวอักขระพิเศษเหล่านั ้นได้อย่างไร?
วันนี้ผมจะมาแนะนำวิธีเรียกใช้งานตัวอักษร หรือตัวอักขระพิเศษเหล่านั้นด้วยปุ่ม Alt คีย์ ซึ่งมีวิธีการดังต่อไปนี้
วิธี การ ก็คือ ให้กดปุ่ม Alt คีย์ค้างไว้ ตามด้วยกดปุ่มตัวเลข 4 หลักบนคีย์บอร์ด เมื่อกดปุ่มตัวเลข 4 หลักบนคีย์บอร์ดที่ต้องการเรียบร้อยแล้ว ให้ปล่อยปุ่ม Alt คีย์ที่กดค้างไว้ จากนั้นคุณก็จะเห็นตัวอักษร หรือตัวอักขระพิเศษ ปรากฏขึ้นมาแล้วหล่ะครับ
อ้างอิง:
ยกตัวอย่าง เช่น: Alt-0169 = © or Alt-0174 = ® or Alt-0153 = ™
|
1. ให้ไป Start > Programs > Accessories > System Tools > Character Map
2. หรือไปที่ Start > Run > จากนั้นพิมพ์ว่า Charmap แล้ว OK หรือกดปุ่ม Enter
3. หลังจากที่เปิดโปรแกรมขึ้นมาเรียบร้อยแล้ว ให้เลือกรูปแบบตัวอักษร แล้วคลิกที่ตัวอักษรพิเศษที่คุณต้องการ จากนั้นก็คลิก Copy แล้วเอาไปวางในโปรแกรมที่คุณต้องการ
เห็นไหมหล่ะครับ วิธีการง่ายๆเพียงเท่านี้ คุณก็จะสามารถใช้งานตัวอักษรหรือตัวอักขระพิเศษได้แล ้วหล่ะครับ
เครดิต:Webmonster
ที่มา http://webmonster.sapaan.net/archives/90#comment-282
หรือจะลองดูตารางอันนี้ประกอบด้วยได้ครับ
Special Characters — Alt Keyboard Sequences
ที่มา http://tools.oratory.com/altcodes.html
สมัครสมาชิก:
บทความ (Atom)