I have been researching linux shell recently, so I haven't updated it for a long time. Today, when someone talked to me on QQ about samba password ldap centralized authentication, I thought of a problem. The samba server is used to store user data in the Intranet, and all users cannot log on to the LINUX background, how can customers modify their own passwords?
To solve the problem of changing the samba password on the client, you do not need to set up ldap (high maintenance costs ), you do not need to use administrative techniques to calculate the client password. After all, my colleagues are also embarrassed to tell you the password he is used, the changepassword tool allows common users to log on to the WEB to change their passwords, greatly improving work efficiency.
My new blog website has been created, and more new content will be updated on the new site soon ..
WelcomeHttp://www.showerlee.com
SAMBA: centos default yum Source
CHANGEPASSWORD: changepassword-0.9
APACHE: httpd-2.4.4
I. Environment Construction:
1. Disable iptables and SELINUX before configuration to avoid errors during configuration.
# Service iptables stop
# Setenforce 0
# Vi/etc/sysconfig/selinux
---------------
SELINUX = disabled
---------------
2. Install the SDK
# Yum install gcc-y
3. install apache
Transport: http://showerlee.blog.51cto.com/2047005/1174141
2. Configure samba:
1. Install samba:
# Yum install samba-y
2. Configure samba:
To use the changepassword program to change the client password, you must set the system password and samba password synchronization.
# Vi/etc/samba/smb. conf
Search for security = user and add the following content, and comment out passdb backend = tdbsam
----------------
Security = user
Pam password change = no
Passwd chat = ** NEW * UNIX * password * % n \ n * Retype * new * UNIX * password * % n \ n * successfully *
Passwd program = LANG = en_US/usr/bin/passwd % u
Unix password sync = yes
Passdb backend = smbpasswd
Smb passwd file =/etc/samba/smbpasswd
# Passdb backend = tdbsam
--------------------------
Note: The above modification actually changes the tdbsam authentication method to smbpasswd, and stores the authentication file encrypted under/etc/samba/smbpasswd.
Restart the service:
# Service smb restart
Create a samba account (close the User shell Interface)
# Useradd-s/sbin/nologin user01
# Passwd user01
# Smbpasswd-a user01
Note: When creating a samba account, you must set the system account password and smb account password.
Because changepassword is used to change the password, first change the system account password and then synchronize the system account password to the/etc/samba/smbpasswd SMB password library file.
Ii. install and configure changepassword
1. Download and decompress:
# Wget http://prdownloads.sourceforge.net/changepassword/changepassword-0.9.tar.gz
# Tar-zxvf changepassword-0.9.tar.gz
# Cd changepassword-0.9
2. Install a dependency package before compiling changepassword.
# Cd smbencrypt/
# Tar-xzvf libdes-4.04b.tar.gz
# Cd des/
# Make
# Cp libdes. ../
# Cd ../..
3. Compile and install changepassword
#. /Configure-enable-cgidir =/usr/local/apache2/htdocs/samba-enable-language = Chinese-enable-smbpasswd =/etc/samba/smbpasswd-disable-squidpasswd-enable -logo = samba/logo.jpg
Note:-enable-cgidir =... # customize the apache root directory path
-Enable-language = Chinese # Set the page to simplified Chinese
-Enable-smbpasswd =/etc/samba/smbpasswd # library file for customizing samba passwords
(Smbpasswd is not a system command for modifying the smb User Password. Do not confuse it)
-Disable-squidpasswd # disable squid
-Enable-logo =... # Set the web root directory logo file. The relative path here corresponds to the apache root directory
# That is, samba/logo.jpg corresponds to/usr/local/apache2/htdocs/samba/logo.jpg
# Make & make install
4. Set apache to support cgi Module
# Vi/usr/local/apache2/conf/httpd. conf
Search for cgi and remove the following comments:
--------------
LoadModule cgid_module modules/mod_cgid.so
AddHandler cgi-script. cgi
--------------
Search for DocumentRoot, find the Options Option Under the/usr/local/apache2/htdocs category, and change it:
--------------
Options Indexes FollowSymLinks ExecCGI
--------------
Restart service
#/Usr/local/apache2/bin/apachectl restart
5. access the web Background:
Http: // 192.168.7.74/samba/changepassword. cgi
Follow the prompts to change the password and submit it.
Note: The LOGO here is added by the blogger. If necessary, you can put the LOGO of your company in the apache web path where changepasswd compiles the logo.
650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131227/1J9591K0-0.png "title =" 1.png"/>
650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131227/1J959A58-1.png "title =" 2.png"/>
Finally, you can access the samba shared folder on the windows client to check whether the password is successfully modified.
Note: This blog does not configure samba because a system account samba is created by default and the system home directory is directly pushed to the Intranet as the shared directory, you can use each LINUX System Account and its home directory to divide the storage space of each user in the company's intranet.
--------------- Success -----------------
This article from "all the way to the North" blog, please be sure to keep this source http://showerlee.blog.51cto.com/2047005/1229563