Use pam_pwdfile.so in FC4 to create a virtual user

Source: Internet
Author: User
Tags crypt
In FC4, pam_pwdfile.so is used to create a virtual user-Linux Enterprise Application-Linux server application information. The following is a detailed description. We 've been working on virtual users over the past few days. Now we have done a good job.
Here we will share the solution steps with you:
First everyone here to download pam_pwdfile-0.99 (installed friends can skip this step)
Http://cpbotha.net/pam_pwdfile.html

Install pam_pwdfile (very simple, I think: P)
1)
Download pam_pwdfile, and then do the following


# Wget http://www.us.kernel.org/pub/lin... ux-PAM-0.75.tar.bz2
# Bunzip2-c Linux-PAM-0.75.tar.bz2 | tar-xvf-
# Cd Linux-PAM-0.75/modules
# Tar-xzvf/you save the path/pam_pwdfile-0.99.tar.gz of pam_pwdfile-0.99.tar.gz (unzip it under modules, don't put it elsewhere .....)
# Cd ..
# Rm default. defs)
# Ln-s defs/redhat. defs default. defs)


Do this in Linux-PAM-0.75/(coming soon ......)
# Make

Make this step succeeded (don't look for me if not) will find a file named pam_pwdfile.so in the Linux-PAM-0.75/modules/pam_pwdfile-0.99,
Haha, all I need is it. Copy it to/lib/security/(this is important .....)

2) After the preparation is complete, configure virtual user

2-1) vsftpd. conf configuration

Anonymous_enable = NO
Local_enable = YES
Write_enable = NO
Local_umask = 022
Dirmessage_enable = YES
Xferlog_enable = YES
Xferlog_file =/var/log/vsftpd. log
Xferlog_std_format = YES
Pam_service_name = vsftpd
Connect_from_port_20 = YES
Ftpd_banner = Welcome to S _ FTP server.
Listen = YES
Listen_port= 2121
One_process_model = NO
Chroot_local_user = YES
Guest_enable = YES
Guest_username = virtualus


2-2) Modify/etc/pam. d/vsftpd (comment out the original one !!)

Auth required pam_pwdfile.so pwdfile/etc/vsftpd/passwd_ftp
Account required pam_permit.so


2-3) create a script for MD5 encryption of the virtual user password/etc/vsftpd/filter. pl and enter the following content in it:

#! /Usr/bin/perl-w
Use strict;

# Filter "user: cleartext" lines into "user: md5_crypted"
# Probably requires glibc

While (<> ){
Chomp;
(My $ user, my $ pass) = split/:/, $ _, 2;
My $ crypt = crypt $ pass, '$1 $'. gensalt (8 );
Print "$ user: $ cryptn ";
}

Sub gensalt {
My $ count = shift;
My @ salt = ('.', '/', 0 .. 9, 'A'... 'Z', 'A'... 'Z ');
My $ s;
$ S. = $ salt [rand @ salt] for (1 .. $ count );
Return $ s;
}


2-4) modify the filter. pl attribute
# Chmod + x/etc/vsftpd/filter. pl

2-5) Create a New us.txt file that creates a virtual user as follows:
Qq: 123 (pp is a virtual user and 123 is his password)
Pp: 456

2-6) write the virtual user information to passwd_ftp (after this step, you can delete us.txt. For security, do not contact me if you forget your password: em11 :)

# Perl/etc/vsftpd/filter. pl./us.txt>/etc/vsftpd/passwd_ftp


3) Restart vsftpd
# Service vsftpd restart

4) You can skip step 4 ..........
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.