手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

Fedora 16 安装 Samba 3.6

[日期:2012-03-11] 来源:Linux社区  作者:icanoncn [字体:大 中 小]

然后就简单了,先在防火墙添加例外,如我的Win7电脑地址是192.168.1.3:

#vi /etc/sysconfig/iptables

在中间添加 :

-A INPUT -j ACCEPT -s 192.168.1.3

保存退出。 

之后是 SELinux :

#setsebool -P samba_enable_home_dirs on

之后确认一下:

 #getsebool -a | grep samba

若看到有一项 samba_enable_home_dirs --> on 则表示成功 

然后建立 samba 验证密码:

#smbpasswd -a 用户名(Linux系统里必须存在)


好了,到 Windows 的网上邻居里查一下,看看能否访问 Fedora,

或者 开始 -> 运行 -> \\Fedora的 IP 地址 ,如 \\192.168.1.4


另外,Fedora的主机名,如果在默认安装时不改,会在 Windows 网上邻居里显示 LOCALHOST ,

这会与Windows 的本机冲突,双击 LOCALHOST 进入的是 Windows 本机,

所以需要在 Fedora 里修改:

#vi /etc/sysconfig/network

将HOSTNAME修改成其他名字。 

好了,如此基本成,另附Samba 3.5 的 smb 脚本:

#!/bin/sh

#

# chkconfig: - 91 35

# description: Starts and stops the Samba smbd daemon \

#       used to provide SMB network services.

#

# pidfile: /var/run/samba/smbd.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 1

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 1

 

# Check that smb.conf exists.

[ -f /etc/samba/smb.conf ] || exit 6

 

RETVAL=0

 

 

start() {

        KIND="SMB"

echo -n $"Starting $KIND services: "

daemon smbd $SMBDOPTIONS

RETVAL=$?

echo

[ $RETVAL -eq 0 ] && touch /var/lock/subsys/smb || \

  RETVAL=1

return $RETVAL

}

 

stop() {

        KIND="SMB"

echo -n $"Shutting down $KIND services: "

killproc smbd

RETVAL=$?

echo

[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/smb

return $RETVAL

}

 

restart() {

stop

start

}

 

reload() {

        echo -n $"Reloading smb.conf file: "

killproc smbd -HUP

RETVAL=$?

echo

return $RETVAL

}

 

rhstatus() {

status -l smb smbd

return $?

}

 

 

# Allow status as non-root.

if [ "$1" = status ]; then

       rhstatus

       exit $?

fi

 

uid=`id | cut -d\( -f1 | cut -d= -f2`

 

# Check that we stop here for non-root users

[ $uid -ne 0 ] && exit 4

 

 

 

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 2

esac

 

exit $?

linux
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款