Samba authentication through PAM with MySQL

2009-05-13 02:30:16来源:未知 阅读 ()

新老客户大回馈,云服务器低至5折


Ed. note: Randall actually wrote this article back in November, but I've only just put
    it on the site today.
Note: this assumes you have
Samba
,
mySQL
and
pam_mysql
    already installed and running on
FreeBSD
4.0 or
    greater The following describes how to setup Samba, PAM, and mySQL such that Samba users
    are authenticated through MySQL using PAM.
   
You can obtain pam_mysql from the link above, or you can install it from the ports: /usr/ports/security/pam-mysql.
   
by:
randall s. ehren
  
  
   
  
  
   
    Step 1: Configure MySQL
   
  
  
    The following inserts the root user and a sample user both with a password of
    "secretpw". The password encryption is done via MySQL's ENCRYPT function. insert
    the following SQL:
CREATE DATABASE samba_auth;
CREATE TABLE users (
   uid int(6) NOT NULL auto_increment,
   gid int(6) DEFAULT '0' NOT NULL,
   last_name varchar(80) NOT NULL,
   first_name varchar(80) NOT NULL,
   login varchar(16) NOT NULL,
   date datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
   password varchar(16) NOT NULL,
   PRIMARY KEY (uid),
   KEY uid (uid),
   UNIQUE uid_2 (uid)
);
INSERT INTO users VALUES (
   '0', '0', 'account', 'root', 'root',
   'NOW()', ENCRYPT('secretpw')
);
INSERT INTO users VALUES (
   '1', '1', 'account', 'sample', 'sample',
   'NOW()', ENCRYPT('secretpw')
);
   
  
  
   
  
  
   
    Step 2: Configure PAM
   
  
  
    pam_mysql has the following configuration options available:(options in parentheses
    are defaults)
  • user(nobody) -- The user with access to the open the connection to mysql and has
            permission to read the table with the passwords.
          
  • passwd("") -- Password for the same.
          
  • host(localhost) -- Machine that is running the sql server
          
  • db(mysql) -- database that contents the table with the user/password combos
          
  • table(user) -- table that you want to use for the user/password checking
          
  • usercolumn(User) -- column that has the username field
          

    标签:

    版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
    特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:qmail安装脚本

下一篇:探究为什么使用freeBSD的原因 (1)