Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Server Operation

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 15th April 2008, 19:58
Nikitos Nikitos is offline
Junior Member
 
Join Date: Feb 2008
Posts: 14
Thanks: 0
Thanked 2 Times in 2 Posts
Default RHEL5.1\CENT.OS 5.1 VSFTPD auth via mysql

Hello

I want to setup vsftpd server like Virtual Hosting With vsftpd And MySQL On Debian Etch but on RHEL5.1(Cent.os)
I`ve install pam_mysql from EPEL, create database, use debian`s config for vsftpd.conf.... add to pam/vsftpd like in debian one ... but then I tried to login I have a message that login is incorrect

Can you help me?
Reply With Quote
Sponsored Links
  #2  
Old 16th April 2008, 22:26
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,713 Times in 2,556 Posts
Default

What's in /etc/vsftpd.conf and the vsftpd pam file?
What's the exact error message? Any errors in your logs?
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #3  
Old 17th April 2008, 09:14
Nikitos Nikitos is offline
Junior Member
 
Join Date: Feb 2008
Posts: 14
Thanks: 0
Thanked 2 Times in 2 Posts
Default Vsftpd

/etc/vsftpd/vsftpd.conf
Quote:
listen=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
nopriv_user=vsftpd
chroot_local_user=YES
secure_chroot_dir=/var/run/vsftpd
pam_service_name=vsftpd
#rsa_cert_file=/etc/ssl/certs/vsftpd.pem
guest_enable=YES
guest_username=vsftpd
local_root=/home/vsftpd/$USER
user_sub_token=$USER
virtual_use_local_privs=YES
user_config_dir=/etc/vsftpd/vsftpd_user_conf
/etc/pam.d/vsftpd
Quote:
auth required pam_mysql.so user=vsftpd passwd=password host=localhost db=vsftpd table=accounts usercolumn=username passwdcolumn=pass crypt=2

account required pam_mysql.so user=vsftpd passwd=password host=localhost db=vsftpd table=accounts usercolumn=username passwdcolumn=pass crypt=2
/var/log/vsftpd.log
Quote:
Tue Apr 15 17:42:26 2008 [pid 3260] [test] FAIL LOGIN: Client "192.168.1.2"
Tue Apr 15 17:56:53 2008 [pid 2354] CONNECT: Client "192.168.1.2"
Tue Apr 15 17:56:53 2008 [pid 2353] [test] FAIL LOGIN: Client "192.168.1.2"
Thu Apr 17 06:59:55 2008 [pid 2322] CONNECT: Client "192.168.1.2"

Last edited by Nikitos; 17th April 2008 at 09:17.
Reply With Quote
  #4  
Old 17th April 2008, 10:06
topdog topdog is offline
Senior Member
 
Join Date: Jan 2008
Location: South Africa
Posts: 1,352
Thanks: 0
Thanked 152 Times in 149 Posts
Default

Turn on debug and see what is being logged in syslog
__________________
----
http://www.topdog.za.net - Got Linux problems ? - I can help.
http://www.baruwa.org - Try it.
Reply With Quote
  #5  
Old 17th April 2008, 11:43
Nikitos Nikitos is offline
Junior Member
 
Join Date: Feb 2008
Posts: 14
Thanks: 0
Thanked 2 Times in 2 Posts
Default

i add log all querys to my.cnf and i saw in log that
Quote:
080417 13:39:00 4 Connect vsftpd@localhost on vsftpd
4 Init DB vsftpd
4 Query SELECT pass FROM accounts WHERE username = 'test'
4 Query SELECT pass FROM accounts WHERE username = 'test'
4 Quit
080417 13:39:06 5 Connect vsftpd@localhost on vsftpd
5 Init DB vsftpd
5 Query SELECT pass FROM accounts WHERE username = 'nikita'
5 Query SELECT pass FROM accounts WHERE username = 'nikita'
5 Quit
/var/logs/secure
Quote:
Apr 17 13:36:05 localhost vsftpd: pam_mysql - SELECT returned no result.
Apr 17 13:39:00 localhost last message repeated 4 times
Apr 17 13:40:38 localhost last message repeated 2 times

Last edited by Nikitos; 17th April 2008 at 13:03.
Reply With Quote
  #6  
Old 17th April 2008, 14:29
topdog topdog is offline
Senior Member
 
Join Date: Jan 2008
Location: South Africa
Posts: 1,352
Thanks: 0
Thanked 152 Times in 149 Posts
Default

the query is not returning any data connect to the db as that user and run the same query.
__________________
----
http://www.topdog.za.net - Got Linux problems ? - I can help.
http://www.baruwa.org - Try it.
Reply With Quote
  #7  
Old 17th April 2008, 20:59
Nikitos Nikitos is offline
Junior Member
 
Join Date: Feb 2008
Posts: 14
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Query as vsftpd user works normal

Quote:
[root@linux log]# mysql -u vsftpd -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 5.0.22-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use vsftpd;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> SELECT pass FROM accounts WHERE username = 'test' ;
+------------------+
| pass |
+------------------+
| 428567f408994404 |
+------------------+
1 row in set (0.01 sec)
When i do your this query Log in /var/logs/secure don`t have any errors

Last edited by Nikitos; 17th April 2008 at 21:01.
Reply With Quote
  #8  
Old 17th April 2008, 21:00
topdog topdog is offline
Senior Member
 
Join Date: Jan 2008
Location: South Africa
Posts: 1,352
Thanks: 0
Thanked 152 Times in 149 Posts
Default

Turn on pam_mysql's own debug such that you see what happens to the whole process.

logging queries from mysql will not give you the full picture.
__________________
----
http://www.topdog.za.net - Got Linux problems ? - I can help.
http://www.baruwa.org - Try it.
Reply With Quote
  #9  
Old 19th April 2008, 21:16
Nikitos Nikitos is offline
Junior Member
 
Join Date: Feb 2008
Posts: 14
Thanks: 0
Thanked 2 Times in 2 Posts
 
Default

Enable Pam_mysql log:

Quote:
auth required pam_mysql.so user=vsftpd passwd=password host=localhost db=vsftpd table=accounts usercolumn=username passwdcolumn=pass crypt=2 sqllog=1 logtable=logs logmsgcolumn=msg logusercolumn=user logpidcolumn=pid loghostcolumn=host logrhostcolumn=rhost logtimecolumn=logtime

account required pam_mysql.so user=vsftpd passwd=password host=localhost db=vsftpd table=accounts usercolumn=username passwdcolumn=pass crypt=2 sqllog=1 logtable=logs logmsgcolumn=msg logusercolumn=user logpidcolumn=pid loghostcolumn=host logrhostcolumn=rhost logtimecolumn=logtime

Pam_mysql log
Quote:
+------------------------------------+------+------+-----------+-------------+---------------------+
| msg | user | pid | host | rhost | logtime |
+------------------------------------+------+------+-----------+-------------+---------------------+
| AUTHENTICATION FALURE (FIRST_PASS) | test | 2757 | 127.0.0.1 | 192.168.1.2 | 2008-04-19 23:07:24 |
| AUTHENTICATION FAILURE | test | 2757 | 127.0.0.1 | 192.168.1.2 | 2008-04-19 23:07:24 |
+------------------------------------+------+------+-----------+-------------+---------------------+
2 rows in set (0.00 sec)
Mysql query log:
Quote:
080419 23:07:24 4 Connect vsftpd@localhost on vsftpd
4 Init DB vsftpd
4 Query SELECT pass FROM accounts WHERE username = 'test'
4 Query INSERT INTO logs (msg, user, host, rhost, pid, logtime) VALUES ('AUTHENTICATION FALURE (FIRST_PASS)', 'test', '127.0.0.1', '192.168.1.2', '2757', NOW())

4 Query SELECT pass FROM accounts WHERE username = 'test'
4 Query INSERT INTO logs (msg, user, host, rhost, pid, logtime) VALUES ('AUTHENTICATION FAILURE', 'test', '127.0.0.1', '192.168.1.2', '2757', NOW())

4 Quit
/var/log/secure doesn`t have any errors
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting e-mail working hansoffate Installation/Configuration 29 13th August 2008 16:33
Management/system config/settings & /server/settings not working!! dactor Installation/Configuration 9 6th February 2008 09:11
LAMP System Fedora Core 6 MySQL start error gavino HOWTO-Related Questions 13 21st November 2007 19:13
Messed up ISPConfig-2.2.8 Upgrade Morons Installation/Configuration 4 29th November 2006 12:17
Mandriva 10.2 Perfect Setup Install Problems... ctroyp Installation/Configuration 12 30th December 2005 16:04


All times are GMT +2. The time now is 14:07.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.