Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Pureftpd and PostgreSQL together

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Xiaobian to share with you how to use Pureftpd and PostgreSQL jointly, I believe most people still do not know how to use, so share this article for your reference, I hope you have a lot of harvest after reading this article, let's go to understand it together!

Pureftpd is an open-source GPL-compliant software for use on a variety of Unix. How does it work with PostgreSQL? See below.

First of all, we should know what PostgreSQL is. PostgreSQL is an enhanced version of the POSTGRES database management system, a research prototype for the next generation DBMS. PostgreSQL replaces the original PostQuel query language with an extended subset of SQL, while maintaining POSTGRES 'robust data model and rich data types. PostgreSQL is free and all source code is available.

PostgreSQL development is done by a team of developers who participate in the PostgreSQL development mailing list. The current coordinator is Marc G. Fournier (scrappy@postgreSQL.org )。This team is now responsible for all development of PostgreSQL.

PostgreSQL 1.01 was written by Andrew Yu and Jolly Chen. There are many others who contribute heavily to porting, testing, debugging, and enhancing code. Postgres, the original origin of PostgreSQL, was developed by a number of graduate students, undergraduates, and programming staff under the direction of Professor Michael Stonebraker at the University of California, Berkeley.

This software was originally named Postgres at Berkeley. In 1995, when SQL functionality was added, the name was changed to Postgres95. In late 1996, it was renamed PostgreSQL. The current version of *** is 8.1.5.

install PostgreSQL

We first unzip PostgreSQL from www.postgresql.org in *** version, postgresql-8.1.5.tar.gz

# tar xzvf postgresql-8.1.5.tar.gz # cd postgresql-8.1.5

Install according to the quick installation method

# ./ configure # gmake //be sure to use GNU make # make install # adduser postgres //also added postgres group # mkdir /usr/local/pgsql/data # chown postgres /usr/local/pgsql/data # su - postgres

$ /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data

$ /usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data >logfile 2>&1 & //start database

$ /usr/local/pgsql/bin/createdb test //create a database test

$ /usr/local/pgsql/bin/psql test //enter database test with interactive psql tool

$Exit psql with\q command

Set the environment variable LD_LIBRARY_PATH

$ vi .bash_profile

join

LD_LIBRARY_PATH=/usr/local/pgsql/lib

And add PATH=$PATH:$HOME/bin

:/usr/local/pgsql/bin

Add LD_LIBRARY_PATH after export and save exit, execute

$ source .bash_profile

The overall look should be as follows:

# .bash_profile # Get the aliases and functions

if [ -f ~/.bashrc ]; then

. ~/.bashrc

fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin:/usr/local/pgsql/bin

LD_LIBRARY_PATH=/usr/local/pgsql/lib

export PATH LD_LIBRARY_PATH

unset USERNAME

$ psql -l //View existing database

$ psql //enter psql interactive mode

=# CREATE USER pureftpd WITH PASSWORD ' pureftpd ';

=# CREATE DATABASE pureftpd WITH OWNER = pureftpd TEMPLATE = template0 ENCODING = 'EUC_CN';

=# \q

$ psql -l

List of databases

Name | Owner | Encoding

-----------+----------+----------

postgres | postgres | UTF8

pureftpd | pureftpd | EUC_CN

template0 | postgres | UTF8

template1 | postgres | UTF8

test | postgres | UTF8

(5 rows)

$ createlang plpgsql pureftpd

$ psql -U pureftpd

pureftpd=>

DROP TABLE users CASCADE;

DROP SEQUENCE users_id_seq CASCADE;

CREATE TABLE "users" (

id integer DEFAULT nextval('users_id_seq'::text) NOT NULL,

"User" character varying(16) NOT NULL default '',

status smallint default 0, //this parameter is not used

"Password" character varying(64) NOT NULL default '',

"Uid" character varying(11) DEFAULT -1 NOT NULL,

"Gid" character varying(11) DEFAULT -1 NOT NULL,

"Dir" character varying(128) NOT NULL,

"comment" text,

ipaccess character varying(15) DEFAULT '*' NOT NULL,

"ULBandwidth" smallint default 0,

"DLBandwidth" smallint default 0,

"QuotaSize" integer DEFAULT 0,

"QuotaFiles" integer DEFAULT 0,

ULRatio smallint default 0,

DLRatio smallint default 0,

create_date timestamp with time zone DEFAULT now() NOT NULL,

modify_date timestamp without time zone DEFAULT now() NOT NULL

);

CREATE SEQUENCE users_id_seq;

CREATE INDEX users_index ON users (id,"User");

ALTER TABLE ONLY users ADD CONSTRAINT users_pkey PRIMARY KEY (id);

ALTER TABLE ONLY users ADD CONSTRAINT users_id_key UNIQUE (id, "User");

pureftpd=> \d

List of relations

Schema | Name | Type | Owner

--------+--------------+----------+----------

public | users | table | pureftpd

public | users_id_seq | sequence | pureftpd

(2 rows)

pureftpd=> INSERT INTO users VALUES (1, 'test', 1, md5('test'), '2000', '2000', '/var/ftp/test', '', '*', 0, 0, 0, 0, 0, 0, '2006-11-27 14:30:00', '2006-11-27 14:30:00');

With that, the database is complete, and we configure the puftpd-pgsql.conf file

# vi /usr/local/pureftpd/etc/pureftpd-pgsql.conf

This is similar to the mysql configuration file we saw earlier, and the modifications are similar, so I won't go into detail here.

Note: in pureftpd-pgsql.conf password encryption I used is

PGSQLCrypt md5

I don't see crypt or encrypt functions, if you have this knowledge, welcome to discuss.

The other one is very important and you need to modify it.

PGSQLGetRatioUL SELECT ULRatio FROM users WHERE User='\L'

PGSQLGetRatioDL SELECT DLRatio FROM users WHERE User='\L'

for

PGSQLGetRatioUL SELECT "ULRatio" FROM "users" WHERE "User"='\L'

PGSQLGetRatioDL SELECT "DLRatio" FROM "users" WHERE "User"='\L'

Format, otherwise it cannot be authenticated.

Modify pure-ftpd.conf file, just like mysql, change one entry

PGSQLConfigFile /usr/local/pureftpd/etc/pureftpd-pgsql.conf

Test after restarting pureftpd program, same permissions as when authenticating with mysql database.

The above is "How to use Pureftpd and PostgreSQL jointly" all the contents of this article, thank you for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report