Fedora 16 安装 Samba 3.6(2)

然后就简单了,先在防火墙添加例外,如我的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 $?

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/22360.html