一台centOS 5 机子 用客户端连接上之后
从启动服务比如
显示英文是乱码
[root@localhost ~]# /etc/init.d/smb restart
鍏抽棴 SMB 鏈嶅姟锛?[60G[纭畾]
鍏抽棴 NMB 鏈嶅姟锛?[60G[纭畾]
鍚姩 SMB 鏈嶅姟锛?[60G[纭畾]
鍚姩 NMB 鏈嶅姟锛?[60G[纭畾]
鍏抽棴 SMB 鏈嶅姟锛?[60G[纭畾]
鍏抽棴 NMB 鏈嶅姟锛?[60G[纭畾]
鍚姩 SMB 鏈嶅姟锛?[60G[纭畾]
鍚姩 NMB 鏈嶅姟锛?[60G[纭畾]
root@localhost ~]#
显示为乱码
采取方法:
[root@localhost ~]# vi /etc/sysconfig/i18n
#LANG="zh_CN.UTF-8"
LANG="en_US"
LANG="en_US"
注:将原来的LANG="zh_CN.UTF-8" 注释掉,添加LANG="en_US"
重新登录显示正常
[root@localhost ~]# /etc/init.d/smb restart
Shutting down SMB services: [ OK ]
Shutting down NMB services: [ OK ]
Starting SMB services: [ OK ]
Starting NMB services: [ OK ]
Shutting down SMB services: [ OK ]
Shutting down NMB services: [ OK ]
Starting SMB services: [ OK ]
Starting NMB services: [ OK ]
[root@localhost ~]#
二、samba 配置
vi /etc/samba/smb.conf
配置文件内容
[global]
workgroup = workgroup
server string = Bang File Server
display charset = UTF8
dos charset = cp950
unix charset = gb2312
netbios name = bangfileserver
hosts allow = 127. 192.168.0. 192.168.6.
log file = /var/log/samba/%m.log
max log size = 500
smb passwd file = /etc/samba/smbpasswd
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
load printers = yes
cups options = raw
[homes]
comment = Home Directories
browseable = no
writable = yes
[printers]
comment = All Printers
path = /var/spool/samba
browseable = no
guest ok = no
writable = no
printable = yes
[bo]
comment = Bang File Server
path = /opt/bo
create mask = 0660
directory mask = 0770
writeable = yes
valid users = @jishu,bo
browseable = yes
force group = bo
[soft]
comment = Bang File Server
path = /opt/soft
create mask = 0644
directory mask = 0755
writeable = yes
valid users = @sheji,bo,nobody
browseable = yes
guest ok = yes
force group = root
workgroup = workgroup
server string = Bang File Server
display charset = UTF8
dos charset = cp950
unix charset = gb2312
netbios name = bangfileserver
hosts allow = 127. 192.168.0. 192.168.6.
log file = /var/log/samba/%m.log
max log size = 500
smb passwd file = /etc/samba/smbpasswd
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
load printers = yes
cups options = raw
[homes]
comment = Home Directories
browseable = no
writable = yes
[printers]
comment = All Printers
path = /var/spool/samba
browseable = no
guest ok = no
writable = no
printable = yes
[bo]
comment = Bang File Server
path = /opt/bo
create mask = 0660
directory mask = 0770
writeable = yes
valid users = @jishu,bo
browseable = yes
force group = bo
[soft]
comment = Bang File Server
path = /opt/soft
create mask = 0644
directory mask = 0755
writeable = yes
valid users = @sheji,bo,nobody
browseable = yes
guest ok = yes
force group = root
[root@localhost lebang]# vi /etc/sysconfig/i18n
配置文件内容
配置文件内容
LANG="en_US"
这样在客户端XP上传文件和目录 ,在linux 下看也是正常的。用户ssh secure file transfer上传文件也是正常的。
2、当客户端上传文件时,文件名是中文时,连接linux 软件用putty显示是乱码,用secureCRT 是正常的,这是可能就是客户软件的问题。
注:
在客户端上传文件时一定要用“binary”方式,否则在XP下用记事本打开服务器上文件对“回车符”不能正确识别。
三、要使用changepassword 程序实现,客户端更改密码必须设置系统密码和samba密码同步。
smb.conf文件中要有
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
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
安装changepassword 其实很简单,网上也有高手写的中文文档,也可以直接看软件包中自带的README 文件。
基本是以下这样
1、[root@test-samba changepassword-0.9]# ./configure --enable-cgidir=/var/www/cgi-bin --enable-language=Chinese --enable-smbpasswd=/etc/samba/smbpasswd --disable-squidpasswd --enable-logo=opentech.jpg
2、[root@test-samba changepassword-0.9]# make
3、[root@test-samba changepassword-0.9]# make install
cp changepassword.cgi /var/www/cgi-bin/changepassword.cgi
chmod 4755 /var/www/cgi-bin/changepassword.cgi
[root@test-samba changepassword-0.9]#
3、[root@test-samba changepassword-0.9]# make install
cp changepassword.cgi /var/www/cgi-bin/changepassword.cgi
chmod 4755 /var/www/cgi-bin/changepassword.cgi
[root@test-samba changepassword-0.9]#
容易出现的问题:
1、make: *** [changepassword.cgi] Error 1
配置中仔细查看./configure 是否有误。
2、在IE访问
[url]http://192.168.6.143/cgi-bin/changepassword.cgi[/url]时,输入用户名和密码点击 change 出现下面的错误信息
Could not rename the temporary password file.
Please go back and try again.
你可以更改 conf.d文件中的
char TMPFILE[]="/changepw/changepassword-shadow-XXXXXX";
char TMPSMBFILE[]="/changepw/changepassword-smb-XXXXXX";
char TMPSQUIDFILE[]="/changepw/changepassword-squid-XXXXXX";
char TMPSMBFILE[]="/changepw/changepassword-smb-XXXXXX";
char TMPSQUIDFILE[]="/changepw/changepassword-squid-XXXXXX";
这个目录changepw是手动创建的最好与/tmp权限一样。
对XP为客户端访问smb服务器时,客户端记住密码的方法:
打开开始---本地安全设置---密码策略---
强制密码历史更改为1到24之间
密码最短存留期更改为1到999之间
这样更改后系统会记住你的密码。
当需要输入其它用户名和密码来访问smb时,需要在
打开开始---控制面板---用户帐户---点击我的帐户---管理我的网络密码
转载于:https://blog.51cto.com/future/109550