LINUX8.0下SAMBA的配置方法(二)

发表于:2007-07-04来源:作者:点击数: 标签:
在win9x机器上修改注册表 WinNT: OHKEY_LOCAL_MACHINE\SYSTEM\ Currentcontrolset\Services\Kdr\Parameters Win98: HKEY_LOCAL_MACHINE\SYSTEM\Currentcontrolset\Services\Vxd\ .net sup Win2000: HKEY_LOCAL_MACHINE\SYSTEM\Currentcontrolset\Services\La

  在win9x机器上修改注册表
  WinNT: OHKEY_LOCAL_MACHINE\SYSTEM\ Currentcontrolset\Services\Kdr\Parameters
  Win98: HKEY_LOCAL_MACHINE\SYSTEM\Currentcontrolset\Services\Vxd\.netsup
  Win2000: HKEY_LOCAL_MACHINE\SYSTEM\Currentcontrolset\Services\LanmanWorkstation\Parameters
  在此处追加键值:键名EnablePlainTextpasswd,值类型为DWORD,值1,此目的主要是因为samba无法还原加密口令,使注册不成功,修改后即可。点击网上邻居,添加NETBEUI协议、TCP/IP协议、Microsoft网络用户,如果使用了DNS要键入DNS的IP地址。从控制面板中点击用户,添加一个Linux中存在的用户,保持与Linux系统中的用户和密码一致,重启计算机,以Linux用户登录即可看到Linux机器。
  执行netstat –A 192.168.7.148(或主机名)
  在Linux机器上执行
  smbclient –L //server
  smbclient \\\\server\\共享目录
  可访问win9x 资源,但不能 copy.
  创建一个目录 /mnt/smb,执行
  smbmount \\\\server\\共享目录 /mnt/smb
  可访问win9x 资源,并能执行cp 命令。
  Smbumount /mnt/smb 挂点失败。
  如果想Linux启动后win9x机器就能看到,须作如下处理:
  配置 /etc/rc.d/init.d/smb脚本,配置文件如下:
  # ! /bin/sh
  #
  # chkconfig: -91 35
  # description:starts and stops the samba smbd and nmbd daemons\
  # used to provide SMB network services
  #
  #pidfile:/var/run/samba/smbd.pid
  #pidfile:/var/run/samba/nmbd.pid
  #config:/etc/samba/smb.conf
  #source function library
  if [-f /etc/init.d/functions]: then
  ./etc/init.d/functions
  elif [-f /etc/rc.d/init.d/functions]:then
  ./etc/rc.d/init.d/functions
  else
  exit 0
  fi
  #Avoid using root’s TMPDIR
  unset TMPDIR
  #source networking configuration
  ./etc/sysconfig/network
  if [-f /etc/sysconfig/samba]:then
  ./etc/sysconfig/samba
  fi
  #check that networking is up
  [${NETWORKING}=”no”]&& exit 0
  #check that smb.conf exists
  [-f /etc/samba/sb.conf] || exit 0
  #check that we can write to it …so non-root users stop her
  [-w /etc/samba/smb.conf] || exit 0
  RETVAL=0
  start() {
  echo –n $”starting SMB services:”
  daemon /usr/sbin/smbd –D
  RETVAL=$?
  echo
  echo –n $ “starting NMB services:”
  daemon /usr/sbin/nmbd –D
  RETVAL2=$?
  Echo
  [$RETVAL –eq o –a $RETVAL 2 –eq o] && touch /var/lock/subsys/smb || \
  RETVAL=1
  return $RETVAL
  }
  stop(){
  echo –n $”shutting down SMB services:”
  killproc /usr/sbin/smbd
  RETVAL=$?
  echo
  echo –n $”shutting down NMB services:”
  killproc /usr/sbin/nmbd
  RETVAL2=$?
  [$RETVAL –eq 0 –a $RETVAL2 eq 0] && rm –f /var/lock/subsys/smb
  echo “”
  return $RETVAL
  }
  restart(){
  $0 stop
  $0 start
  RETVAL=$?
  }
  reload(){
  echo –n $”Reloading smb.conf file:”
  killproc –HUP /usr/sbin/smbd
  RETVAL=$?
  Echo
  Return $RETVAL
  }
  rhstatus(){
  status /usr/sbin/smbd
  status /usr/sbin/nmbd
  RETVAL=$?
  }
  case “$1” in
  start)
  start
  ::
  stop)
  stop
  ::
  restart)
  restart
  ::
  reload)
  reload
  ::
  status)
  rhstatus
  ::
  condrestart)
  [-f /var/lock/subsys/smb] && restart || :
  ::
  *)
  echo $ “Usage:$0{start|stop|restart|reload|status|condrestart}”
  exit 1
  esac
  exit $?
  然后在命令行下执行
  chmod 700 /etc/rc.d/init.d/smb
  chkconfig --add smb
  chkconfig --level 345 smb on
  配置 /etc/pam.d/samba 文件添加:
  Auth required /lib/security/pam_pwdb.so nullok shadow
  Aclearcase/" target="_blank" >ccount required /lib/security/pam_pwdb.so
  配置 /etc/logrotate.d/samba文件
  /var/log/samba/log.nmdb{
  notifempty
  missingok
  postrotate
  /usr/bin/killall –HUP nmbd
  endrotate
  }
  /var/log/samba/log.smbd{
  notifempty
  missingok
  postrotate
  /usr/bin/killall –HUP smbd
  endrotate
  }
  
  

原文转自:http://www.ltesting.net