歡迎您光臨本站 註冊首頁

[轉]VSFTP+MySQL虛擬用戶配置

←手機掃碼閱讀     火星人 @ 2014-03-05 , reply:0

[轉]VSFTP+MySQL虛擬用戶配置

VSFTPD是一種在UNIX/Linux中非常安全且快速的FTP伺服器,目前已經被許多大型站點所採用。VSFTPD支持將用戶名和口令保存在資料庫文件或資料庫伺服器中。VSFTPD稱這種形式的用戶為虛擬用戶。相對於FTP的本地(系統)用戶來說,虛擬用戶只是FTP伺服器的專有用戶,虛擬用戶只能訪問FTP伺服器所提供的資源,這大大增強系統本身的安全性。相對於匿名用戶而言,虛擬用戶需要用戶名和密碼才能獲取FTP伺服器中的文件,增加了對用戶和下載的可管理性。對於需要提供下載服務,但又不希望所有人都可以匿名下載;既需要對下載用戶進行管理,又考慮到主機安全和管理方便的FTP站點來說,虛擬用戶是一種極好的解決方案。本文介紹在RedHat Linux 9上如何將VSFTPD的虛擬用戶名和密碼保存在MySQL資料庫伺服器中。

  一、VSFTPD的安裝

  目前,VSFTPD的最新版本是1.2.0版。官方下載地址為ftp://vsftpd.beasts.org/users/cevans/vsftpd-1.2.0.tar.gz。在安裝前,需要先做以下準備工作:

  VSFTPD默認配置中需要「nobody」用戶。在系統中添加此用戶,如果用戶已經存在,useradd命令有相應提示。
  # useradd nobody
  useradd: user nobody exists

  VSFTPD默認配置中需要「/usr/share/empty」目錄。在系統中此目錄,如果目錄已經存在,mkdir命令有相應提示。
  # mkdir /usr/share/empty/
  mkdir: cannot create directory '/usr/share/empty': File exists

  VSFTPD提供匿名FTP服務時,需要「ftp」用戶和一個有效的匿名目錄。
  # mkdir /var/ftp/
  # useradd -d /var/ftp ftp
  接下來的操作對於ftp用戶是否已經存在都是有用的。
  # chown root.root /var/ftp
  # chmod og-w /var/ftp

  以上準備工作完成後,我們就可以開始編譯源代碼了。假定我們下載的vsftpd-1.2.0.tar.gz在/root目錄,執行以下命令:
  # tar zxvf vsftpd-1.2.0.tar.gz
  # cd vsftpd-1.2.0
  # make
  # make install

  上面的「make install」命令將編譯好的二進位文件、手冊等複製到相應目錄。在RHL9上,可能需要手動執行以下複製:
  # cp vsftpd /usr/local/sbin/vsftpd
  # cp vsftpd.conf.5 /usr/local/share/man/man5
  # cp vsftpd.8 /usr/local/share/man/man8

  接下來,我們複製一個簡單的配置文件作為基礎供後面修改。
  # cp vsftpd.conf /etc
  # cp RedHat/vsftpd.pam /etc/pam.d/ftp
  複製PAM驗證文件,以允許本地用戶登錄VSFTPD。
  # cp RedHat/vsftpd.pam /etc/pam.d/ftp

  二、創建guest用戶

  VSFTPD採用PAM方式驗證虛擬用戶。由於虛擬用戶的用戶名/口令被單獨保存,因此在驗證時,VSFTPD需要用一個系統用戶的身份來讀取資料庫文件或資料庫伺服器以完成驗證,這就是VSFTPD的guest用戶。這正如同匿名用戶也需要有一個系統用戶ftp一樣。當然,我們也可以把guest用戶看成是虛擬用戶在系統中的代表。下面在系統中添加vsftpdguest用戶,作為VSFTPD的guest。
  # useradd vsftpdguest
  當虛擬用戶登錄后,所在的位置為vsftpdguest的自家目錄/home/vsftpdguest。如果要讓虛擬用戶登錄到/var/ftp等其他目錄,修改vsftpdguest的自家目錄即可。

  三、設置VSFTPD配置文件

  在/etc/vsftpd.conf文件中,加入以下選項:
  guest_enable=YES
  guest_username=vsftpdguest

  然後執行以下命令,讓VSFTPD在後台運行:
  # /usr/local/sbin/vsftpd &

  四、將虛擬用戶保存在MySQL資料庫伺服器中

  我們建立資料庫vsftpdvu,表users,欄位name和passwd用於保存虛擬用戶的用戶名和口令,同時增加兩個虛擬用戶xiaotong和xiaowang。

  # mysql -p
  mysql>;create database vsftpdvu;
  mysql>;use vsftpdvu;
  mysql>;create table users(name char(16) binary,passwd char(16) binary);
  mysql>;insert into users (name,passwd) values ('xiaotong',password('qqmywife'));
  mysql>;insert into users (name,passwd) values ('xiaowang',password('ttmywife'));
  mysql>;quit

  然後,授權vsftpdguest可以讀vsftpdvu資料庫的users表。執行以下命令:
  # mysql -u root mysql -p
  mysql>;grant select on vsftpdvu.users to [email protected] identified by 'i52serial0';
  mysql>;quit

  如果要驗證剛才的操作是否成功可以執行下面命令:
  #mysql -u vsftpdguest -pi52serial0 vsftpdvu
  mysql>;select * from users;
  如果成功,將會列出xiaotong、xiaowang和加密后的密碼

  五、設置MySQL的PAM驗證

  這裡我們要用到一個利用mysql進行pam驗證的開源項目(http://sourceforge.net/projects/pam-mysql/)。首先從網站下載它的程序包pam_myql-0.5.tar.gz,複製到/root目錄中。在編譯安裝之前,要確保mysql-devel的RPM包已經安裝在你的機器上,如果沒有請從RHL安裝光碟中安裝該包。然後,執行以下命令:
  #tar xvzf pam_mysql-0.5.tar.gz
  #cd pam_mysql
  #make
  #make install
  make install這一步可能會出現錯誤,那隻好手動將該目錄下生成的pam_mysql.o複製到/lib/security目錄下。
  接下來,我們要設置vsftpd的PAM驗證文件。打開/etc/pam.d/ftp文件,加入以下內容:
  auth required pam_mysql.o user=vsftpdguest passwd=i52serial0 host=localhost db=vsftpdvu table=users usercolumn=name passwdcolumn=passwd crypt=2
  account required pam_mysql.o user=vsftpdguest passwd=i52serial0 host=localhost db=vsftpdvu table=users usercolumn=name passwdcolumn=passwd crypt=2
  上面涉及到的參數,只要對應前面資料庫的設置就可以明白它們的含義。這裡需要說明的是crypt參數。crypt表示口令欄位中口令的加密方式:crypt=0,口令以明文方式(不加密)保存在資料庫中;crypt=1,口令使用UNIX系統的DES加密方式加密后保存在資料庫中;crypt=2,口令經過MySQL的password()函數加密后保存。

  六、進一步的虛擬用戶設置

  經過以上的步驟,虛擬用戶就可以正常使用了。這裡介紹進一步的虛擬用戶設置。首先,介紹虛擬用戶的許可權設置。

  VSFTPD-1.2.0新添了virtual_use_local_privs參數,當該參數激活(YES)時,虛擬用戶使用與本地用戶相同的許可權。當此參數關閉(NO)時,虛擬用戶使用與匿名用戶相同的許可權,這也就是VSFTPD-1.2.0之前版本對虛擬用戶許可權的處理方法。這兩者種做法相比,後者更加嚴格一些,特別是在有寫訪問的情形下。默認情況下此參數是關閉的(NO)。
  當virtual_use_local_privs=YES時,只需設置write_enable=YES,虛擬用戶就可以就擁有寫許可權。而virtual_use_local_privs=NO時,對虛擬用戶許可權的設置就更多一些更嚴格一些。
  控制虛擬用戶瀏覽目錄:如果讓用戶不能瀏覽目錄,但仍可以對文件操作,那麼需要執行以下二個步驟:一,配置文件中,anon_world_readable_only=YES。二,虛擬用戶目錄的許可權改為只能由vsftpdguest操作:
  # chown vsftpdguest.vsftpdguest /home/vsftpdguest
  # chmod 700 /home/vsftpdguest
  允許虛擬用戶上傳文件:
  write_enable=YES
  anon_upload_enable=YES
  允許虛擬用戶修改文件名和刪除文件:
  anon_other_write_enable=YES
  由於以上選項的設置同樣會對匿名用戶生效。如果不想匿名用戶趁機擁有同樣的許可權,最好是禁止匿名用戶登錄。

  其次,由於虛擬用戶在系統中是vsftpdguest身份,所以可以訪問到系統的其他目錄。為了更加安全,我們可以將虛擬用戶限制在自家目錄下。有兩種做法:一,在配置文件中增加以下選項
  chroot_local_user=NO
  chroot_list_enable=YES
  chroot_list_file=/etc/vsftpd.chroot_list
  然後,在/etc/vsftpd.chroot_list文件中加入虛擬用戶名xiaotong和xiaowang。
  第二種做法,在配置文件中修改chroot_local_user=YES。
  經過修改後,虛擬用戶登錄后其根目錄就限制在/home/vsftpdguest下,無法訪問其他目錄。

  七、虛擬用戶的個人目錄

  大家可以發現,無論是哪個虛擬用戶,登錄后所在的目錄都是/home/vsftpdguest,即都是guest_username用戶的自家目錄。下面,介紹如何為每個虛擬用戶建立自家目錄。首先,在主配置文件中加入以下選項:
  user_config_dir=/etc/vsftpd/vsftpd_user_conf
  然後,生成/etc/vsftpd/vsftpd_user_conf目錄,並在該目錄下建立與特定虛擬用戶同名的文件:
  # mkdir /etc/vsftpd/vsftpd_user_conf
  # cd /etc/vsftpd/vsftpd_user_conf
  # touch xiaowang
  以上的操作為虛擬用戶xiaowang建立了個人配置文件/etc/vsftpd/vsftpd_user_conf/xiaowang。接下來,在xiaowang的個人配置文件中將xiaowang的自家目錄修改為/home/xiaowang,配置選項為:
  local_root=/home/xiaowang
  然後,新建xiaowang目錄,並將許可權設為vsftpdguest:
  # mkdir /home/xiaowang
  # chown vsftpdguest.vsftpdguest ./xiaowang
  # chmod 600 /home/xiaowang
  經過以上設置,xiaowang登錄VSFTPD后,用「pwd」指令就可以發現被自己被定位到自己的「/home/xiaowang」目錄。
  從文件系統層次來看,由於「/home/xiaowang」目錄的許可權是屬於vsftpdguest的,所以其他的虛擬用戶同樣也可以訪問xiaowang的自家目錄。解決這個問題也很簡單,我們只需要讓VSFTPD負責將虛擬用戶限制在其自家目錄,就可以避免虛擬用戶的互相訪問。具體做法參照前面第六步中所述,這裡不再贅述。經過以上設置后,虛擬用戶就可以擁有屬於自己的目錄了。
《解決方案》

[轉]VSFTP+MySQL虛擬用戶配置

好東西,先收起來
《解決方案》

[轉]VSFTP+MySQL虛擬用戶配置

大哥,我照你方法配完了。可進去的時候總是說用戶密碼不對阿
《解決方案》

[轉]VSFTP+MySQL虛擬用戶配置

真的不錯,不過我在想,是不是可以用Qmail的Vpopmail庫中的用戶信息作為FTP的用戶來認證,或是修改一下也可,這樣,有一套用戶就可以管理WEB和MAIL了, 
《解決方案》

[轉]VSFTP+MySQL虛擬用戶配置

大哥, 幫幫呀,出現以下錯誤, lmysqlclient 是怎陌回事,
# make
mkdir -p ./dynamic
gcc -shared -Xlinker -x -L/usr/lib/mysql -lz -o pam_mysql.so dynamic/pam_mysql.o  -lmysqlclient -lcrypt
/usr/bin/ld: cannot find -lmysqlclient
collect2: ld returned 1 exit status
make: *** Error 1
《解決方案》

[轉]VSFTP+MySQL虛擬用戶配置

mysql_devel我已經裝上了, 怎樣才能去掉lmysqlclient錯誤呀
《解決方案》

[轉]VSFTP+MySQL虛擬用戶配置

cp /usr/local/mysql/lib/libmysqlclient.10.0 /usr/lib  上面 lmysqlclien的問題解決了,

在客戶端連接時,總是提示口令不對.

找不到問題所在
《解決方案》

[轉]VSFTP+MySQL虛擬用戶配置

好東東啊。可是按裝到這一步出錯了。
大家幫我看看。
我的MYSQL是用tar.gz包按裝的。




qdinfo:~/pam_mysql# ls
Changelog  CREDITS  Makefile  Makefile.bsd  pam_mysql.c  Readme
qdinfo:~/pam_mysql# make
mkdir -p ./dynamic
gcc -O2 -Dlinux -DLINUX_PAM -ansi -D_POSIX_SOURCE -Wall -Wwrite-strings -Wpointer-arith -Wcast-qual -Wcast-align -Wtraditional -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wshadow -pedantic -fPIC -DPAM_DYNAMIC  -c pam_mysql.c -o dynamic/pam_mysql.o
pam_mysql.c:35:25: mysql/mysql.h: 沒有那個文件或目錄
pam_mysql.c:56:34: security/pam_modules.h: 沒有那個文件或目錄
pam_mysql.c:57:31: security/pam_misc.h: 沒有那個文件或目錄
pam_mysql.c:81: error: parse error before '*' token
pam_mysql.c:81: warning: type defaults to `int' in declaration of `mysql_auth'
pam_mysql.c:81: error: ISO C forbids data definition with no type or storage class
pam_mysql.c:106: error: parse error before '*' token
pam_mysql.c:109: warning: function declaration isn't a prototype
pam_mysql.c:111: error: parse error before '*' token
pam_mysql.c:113: warning: function declaration isn't a prototype
pam_mysql.c:115: error: syntax error before "int"
pam_mysql.c:115: error: parse error before '*' token
pam_mysql.c:116: warning: function declaration isn't a prototype
pam_mysql.c:117: error: syntax error before "int"
pam_mysql.c:117: error: parse error before '*' token
pam_mysql.c:118: warning: function declaration isn't a prototype
pam_mysql.c:119: error: syntax error before "int"
pam_mysql.c:119: error: parse error before '*' token
pam_mysql.c:120: warning: function declaration isn't a prototype
pam_mysql.c:121: error: syntax error before "int"
pam_mysql.c:121: error: parse error before '*' token
pam_mysql.c:122: warning: function declaration isn't a prototype
pam_mysql.c:123: error: syntax error before "int"
pam_mysql.c:123: error: parse error before '*' token
pam_mysql.c:124: warning: function declaration isn't a prototype
pam_mysql.c:125: error: syntax error before "int"
pam_mysql.c:125: error: parse error before '*' token
pam_mysql.c:126: warning: function declaration isn't a prototype
pam_mysql.c:133: error: parse error before '*' token
pam_mysql.c:133: warning: function declaration isn't a prototype
pam_mysql.c:141: error: parse error before '*' token
pam_mysql.c:141: warning: function declaration isn't a prototype
pam_mysql.c:143: error: parse error before '*' token
pam_mysql.c:144: warning: function declaration isn't a prototype
pam_mysql.c:151: error: parse error before '*' token
pam_mysql.c:151: warning: function declaration isn't a prototype
pam_mysql.c: In function `breakArgs':
pam_mysql.c:157: warning: traditional C rejects ISO C style function definitions
pam_mysql.c: In function `parseArgs':
pam_mysql.c:233: warning: traditional C rejects ISO C style function definitions
pam_mysql.c: At top level:
pam_mysql.c:391: error: parse error before '*' token
pam_mysql.c:391: warning: function declaration isn't a prototype
pam_mysql.c: In function `db_connect':
pam_mysql.c:392: error: `PAM_AUTH_ERR' undeclared (first use in this function)
pam_mysql.c:392: error: (Each undeclared identifier is reported only once
pam_mysql.c:392: error: for each function it appears in.)
pam_mysql.c:399: error: `PAM_SUCCESS' undeclared (first use in this function)
pam_mysql.c:401: warning: implicit declaration of function `mysql_init'
pam_mysql.c:401: error: `auth_sql_server' undeclared (first use in this function)
pam_mysql.c:402: warning: implicit declaration of function `mysql_real_connect'
pam_mysql.c:404: warning: assignment makes pointer from integer without a cast
pam_mysql.c:407: warning: implicit declaration of function `mysql_select_db'
pam_mysql.c:411: warning: implicit declaration of function `mysql_error'
pam_mysql.c:411: warning: format argument is not a pointer (arg 3)
pam_mysql.c: In function `db_close':
pam_mysql.c:420: warning: traditional C rejects ISO C style function definitions
pam_mysql.c:424: warning: implicit declaration of function `mysql_close'
pam_mysql.c: At top level:
pam_mysql.c:428: error: parse error before '*' token
pam_mysql.c:429: warning: function declaration isn't a prototype
pam_mysql.c: In function `db_checkpasswd':
pam_mysql.c:438: error: `MYSQL_RES' undeclared (first use in this function)
pam_mysql.c:438: error: `result' undeclared (first use in this function)
pam_mysql.c:439: error: `MYSQL_ROW' undeclared (first use in this function)
pam_mysql.c:439: error: parse error before "row"
pam_mysql.c:440: error: `PAM_AUTH_ERR' undeclared (first use in this function)
pam_mysql.c:452: error: `user' undeclared (first use in this function)
pam_mysql.c:456: error: `PAM_BUF_ERR' undeclared (first use in this function)
pam_mysql.c:462: warning: implicit declaration of function `mysql_escape_string'
pam_mysql.c:509: warning: implicit declaration of function `mysql_query'
pam_mysql.c:509: error: `auth_sql_server' undeclared (first use in this function)
pam_mysql.c:513: warning: implicit declaration of function `mysql_store_result'
pam_mysql.c:516: warning: function `mysql_error' was previously declared within a block
pam_mysql.c:516: warning: format argument is not a pointer (arg 3)
pam_mysql.c:517: warning: implicit declaration of function `mysql_free_result'
pam_mysql.c:521: warning: implicit declaration of function `mysql_num_rows'
pam_mysql.c:523: warning: function `mysql_free_result' was previously declared within a block
pam_mysql.c:528: error: `row' undeclared (first use in this function)
pam_mysql.c:528: warning: implicit declaration of function `mysql_fetch_row'
pam_mysql.c:531: warning: function `mysql_error' was previously declared within a block
pam_mysql.c:531: warning: format argument is not a pointer (arg 3)
pam_mysql.c:536: error: `passwd' undeclared (first use in this function)
pam_mysql.c:576: warning: implicit declaration of function `make_scrambled_password'
pam_mysql.c:589: error: `PAM_SUCCESS' undeclared (first use in this function)
pam_mysql.c:603: warning: function `mysql_free_result' was previously declared within a block
pam_mysql.c: At top level:
pam_mysql.c:611: error: parse error before '*' token
pam_mysql.c:613: warning: function declaration isn't a prototype
pam_mysql.c: In function `converse':
pam_mysql.c:617: warning: implicit declaration of function `pam_get_item'
pam_mysql.c:617: error: `pamh' undeclared (first use in this function)
pam_mysql.c:617: error: `PAM_CONV' undeclared (first use in this function)
pam_mysql.c:617: warning: dereferencing type-punned pointer will break strict-aliasing rules
pam_mysql.c:619: error: `PAM_SUCCESS' undeclared (first use in this function)
pam_mysql.c:620: error: dereferencing pointer to incomplete type
pam_mysql.c:620: error: `nargs' undeclared (first use in this function)
pam_mysql.c:621: error: `message' undeclared (first use in this function)
pam_mysql.c:622: error: `response' undeclared (first use in this function)
pam_mysql.c:622: error: dereferencing pointer to incomplete type
pam_mysql.c:623: error: `PAM_CONV_AGAIN' undeclared (first use in this function)
pam_mysql.c:625: warning: implicit declaration of function `pam_strerror'
pam_mysql.c:625: warning: format argument is not a pointer (arg 3)
pam_mysql.c:628: warning: function `pam_strerror' was previously declared within a block
pam_mysql.c:628: warning: format argument is not a pointer (arg 3)
pam_mysql.c: In function `saltify':
pam_mysql.c:636: warning: traditional C rejects ISO C style function definitions
pam_mysql.c:648: warning: implicit declaration of function `time'
pam_mysql.c: At top level:
pam_mysql.c:673: error: parse error before '*' token
pam_mysql.c:675: warning: function declaration isn't a prototype
pam_mysql.c: In function `updatePasswd':
pam_mysql.c:681: error: `PAM_AUTH_ERR' undeclared (first use in this function)
pam_mysql.c:690: error: `user' undeclared (first use in this function)
pam_mysql.c:690: error: `newpass' undeclared (first use in this function)
pam_mysql.c:692: error: `oldpass' undeclared (first use in this function)
pam_mysql.c:692: error: `isRoot' undeclared (first use in this function)
pam_mysql.c:699: error: `PAM_BUF_ERR' undeclared (first use in this function)
pam_mysql.c:732: warning: function `make_scrambled_password' was previously declared within a block
pam_mysql.c:768: warning: function `mysql_escape_string' was previously declared within a block
pam_mysql.c:786: warning: function `mysql_query' was previously declared within a block
pam_mysql.c:786: error: `my' undeclared (first use in this function)
pam_mysql.c:789: warning: function `mysql_error' was previously declared within a block
pam_mysql.c:789: warning: format argument is not a pointer (arg 3)
pam_mysql.c:793: error: `PAM_SUCCESS' undeclared (first use in this function)
pam_mysql.c: At top level:
pam_mysql.c:799: error: parse error before '*' token
pam_mysql.c:800: warning: function declaration isn't a prototype
pam_mysql.c: In function `askForPassword':
pam_mysql.c:801: warning: array type has incomplete element type
pam_mysql.c:801: error: storage size of `msg' isn't known
pam_mysql.c:807: error: `pwprompt' undeclared (first use in this function)
pam_mysql.c:811: error: `PAM_BUF_ERR' undeclared (first use in this function)
pam_mysql.c:817: error: `PAM_PROMPT_ECHO_OFF' undeclared (first use in this function)
pam_mysql.c:820: error: `pamh' undeclared (first use in this function)
pam_mysql.c:823: warning: implicit declaration of function `_pam_overwrite'
pam_mysql.c:824: warning: implicit declaration of function `_pam_drop'
pam_mysql.c:827: error: `PAM_SUCCESS' undeclared (first use in this function)
pam_mysql.c:829: warning: implicit declaration of function `_pam_drop_reply'
pam_mysql.c:830: error: `PAM_CONV_AGAIN' undeclared (first use in this function)
pam_mysql.c:831: error: `PAM_INCOMPLETE' undeclared (first use in this function)
pam_mysql.c:831: error: `PAM_AUTHINFO_UNAVAIL' undeclared (first use in this function)
pam_mysql.c:836: warning: implicit declaration of function `pam_set_item'
pam_mysql.c:836: error: `pwtype' undeclared (first use in this function)
pam_mysql.c:836: error: dereferencing pointer to incomplete type
pam_mysql.c:801: warning: unused variable `msg'
pam_mysql.c: At top level:
pam_mysql.c:839: error: parse error before '*' token
pam_mysql.c:839: warning: function declaration isn't a prototype
pam_mysql.c: In function `sqlLog':
pam_mysql.c:849: error: `PAM_SUCCESS' undeclared (first use in this function)
pam_mysql.c:861: error: `PAM_AUTH_ERR' undeclared (first use in this function)
pam_mysql.c:886: error: `user' undeclared (first use in this function)
pam_mysql.c:890: error: `PAM_BUF_ERR' undeclared (first use in this function)
pam_mysql.c:893: error: `msg' undeclared (first use in this function)
pam_mysql.c:906: warning: function `mysql_escape_string' was previously declared within a block
pam_mysql.c:952: warning: implicit declaration of function `mysql_real_query'
pam_mysql.c:952: error: `auth_sql_server' undeclared (first use in this function)
pam_mysql.c:963: warning: function `mysql_error' was previously declared within a block
pam_mysql.c:963: warning: format argument is not a pointer (arg 3)
pam_mysql.c: At top level:
pam_mysql.c:978: error: syntax error before "int"
pam_mysql.c:978: error: parse error before '*' token
pam_mysql.c:982: warning: function declaration isn't a prototype
pam_mysql.c: In function `pam_sm_authenticate':
pam_mysql.c:989: error: `MYSQL' undeclared (first use in this function)
pam_mysql.c:989: error: parse error before "auth_sql_server"
pam_mysql.c:995: error: `argc' undeclared (first use in this function)
pam_mysql.c:995: error: `argv' undeclared (first use in this function)
pam_mysql.c:999: warning: implicit declaration of function `pam_get_user'
pam_mysql.c:999: error: `pamh' undeclared (first use in this function)
pam_mysql.c:1001: error: `PAM_SUCCESS' undeclared (first use in this function)
pam_mysql.c:1006: error: `PAM_USER_UNKNOWN' undeclared (first use in this function)
pam_mysql.c:1009: warning: function `pam_get_item' was previously declared within a block
pam_mysql.c:1009: error: `PAM_AUTHTOK' undeclared (first use in this function)
pam_mysql.c:1009: warning: dereferencing type-punned pointer will break strict-aliasing rules
pam_mysql.c:1014: warning: dereferencing type-punned pointer will break strict-aliasing rules
pam_mysql.c:1017: error: `PAM_AUTHINFO_UNAVAIL' undeclared (first use in this function)
pam_mysql.c:1019: error: `auth_sql_server' undeclared (first use in this function)
pam_mysql.c: At top level:
pam_mysql.c:1045: error: syntax error before "int"
pam_mysql.c:1045: error: parse error before '*' token
pam_mysql.c:1047: warning: function declaration isn't a prototype
pam_mysql.c: In function `pam_sm_acct_mgmt':
pam_mysql.c:1051: error: `PAM_SUCCESS' undeclared (first use in this function)
pam_mysql.c: At top level:
pam_mysql.c:1055: error: syntax error before "int"
pam_mysql.c:1055: error: parse error before '*' token
pam_mysql.c:1057: warning: function declaration isn't a prototype
pam_mysql.c: In function `pam_sm_setcred':
pam_mysql.c:1061: error: `PAM_SUCCESS' undeclared (first use in this function)
pam_mysql.c: At top level:
pam_mysql.c:1067: error: syntax error before "int"
pam_mysql.c:1067: error: parse error before '*' token
pam_mysql.c:1069: warning: function declaration isn't a prototype
pam_mysql.c: In function `pam_sm_chauthtok':
pam_mysql.c:1077: error: `MYSQL' undeclared (first use in this function)
pam_mysql.c:1077: error: parse error before "auth_sql_server"
pam_mysql.c:1083: error: `argc' undeclared (first use in this function)
pam_mysql.c:1083: error: `argv' undeclared (first use in this function)
pam_mysql.c:1087: warning: function `pam_get_user' was previously declared within a block
pam_mysql.c:1087: error: `pamh' undeclared (first use in this function)
pam_mysql.c:1088: error: `PAM_SUCCESS' undeclared (first use in this function)
pam_mysql.c:1093: error: `PAM_USER_UNKNOWN' undeclared (first use in this function)
pam_mysql.c:1100: error: `auth_sql_server' undeclared (first use in this function)
pam_mysql.c:1104: error: `flags' undeclared (first use in this function)
pam_mysql.c:1104: error: `PAM_PRELIM_CHECK' undeclared (first use in this function)
pam_mysql.c:1109: error: `PAM_CHANGE_EXPIRED_AUTHTOK' undeclared (first use in this function)
pam_mysql.c:1112: warning: function `pam_get_item' was previously declared within a block
pam_mysql.c:1112: error: `PAM_OLDAUTHTOK' undeclared (first use in this function)
pam_mysql.c:1113: warning: dereferencing type-punned pointer will break strict-aliasing rules
pam_mysql.c:1120: warning: dereferencing type-punned pointer will break strict-aliasing rules
pam_mysql.c:1122: error: `PAM_AUTHTOK_ERR' undeclared (first use in this function)
pam_mysql.c:1141: error: `PAM_UPDATE_AUTHTOK' undeclared (first use in this function)
pam_mysql.c:1146: warning: function `pam_get_item' was previously declared within a block
pam_mysql.c:1146: error: `PAM_AUTHTOK' undeclared (first use in this function)
pam_mysql.c:1147: warning: dereferencing type-punned pointer will break strict-aliasing rules
pam_mysql.c:1158: warning: dereferencing type-punned pointer will break strict-aliasing rules
pam_mysql.c:1173: warning: dereferencing type-punned pointer will break strict-aliasing rules
pam_mysql.c:1180: warning: dereferencing type-punned pointer will break strict-aliasing rules
pam_mysql.c: At top level:
pam_mysql.c:1199: error: syntax error before "int"
pam_mysql.c:1199: error: parse error before '*' token
pam_mysql.c:1201: warning: function declaration isn't a prototype
pam_mysql.c: In function `pam_sm_open_session':
pam_mysql.c:1205: error: `PAM_SUCCESS' undeclared (first use in this function)
pam_mysql.c: At top level:
pam_mysql.c:1209: error: syntax error before "int"
pam_mysql.c:1209: error: parse error before '*' token
pam_mysql.c:1211: warning: function declaration isn't a prototype
pam_mysql.c: In function `pam_sm_close_session':
pam_mysql.c:1215: error: `PAM_SUCCESS' undeclared (first use in this function)
make: *** 錯誤 1
《解決方案》

[轉]VSFTP+MySQL虛擬用戶配置

我也是這樣弄得
跟樓上的錯誤一樣!!
那位大蝦能指點一下呀!!
《解決方案》

[轉]VSFTP+MySQL虛擬用戶配置

假定你把mysql裝在了/usr/local/mysql下,
那麼你在編譯pam_mysql的時候一定會出問題,(假定pam_mysql也是用tar.gz方式安裝)
這時候 vi Makefile 一下,把它改成下面的樣子:

ifndef FULL_LINUX_PAM_SOURCE_TREE
export DYNAMIC=-DPAM_DYNAMIC
export CC=gcc
export CFLAGS=-O2 -Dlinux -DLINUX_PAM \
-ansi -D_POSIX_SOURCE -Wall -Wwrite-strings \
-Wpointer-arith -Wcast-qual -Wcast-align -Wtraditional \
-Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline \
-Wshadow -pedantic -fPIC -I/usr/local/mysql/include
export MKDIR=mkdir -p
export LD_D=gcc -shared -Xlinker -x -L/usr/local/mysql/lib/mysql -lz
endif

注意粗體的部分就是你應該改的,當然,如果你按裝在其它目錄,那麼請也相應的改一改,這樣你就可以在當前目錄下得到pam_mysql.so 這個模塊了。

[火星人 ] [轉]VSFTP+MySQL虛擬用戶配置已經有451次圍觀

http://coctec.com/docs/service/show-post-45691.html