오래전 이야기/Server

Install Samba on the FreeBSD

리눅스 엔지니어였던 2008. 9. 15. 13:22
환경: Windows XP , FreeBSD-4.10
 
cd /usr/ports/net/samba
 
make install clean
 
cd /usr/local/etc
 
cp smb.conf.default smb.conf
 
vi smb.conf
 
#======================= Global Settings =====================================
[global]
# workgroup = NT-Domain-Name or Workgroup-Name, eg: REDHAT4
   workgroup = WORKGROUP
# server string is the equivalent of the NT Description field
   server string = FreeBSD Samba Server
# This option is important for security. It allows you to restrict
# connections to machines which are on your local network. The
# following example restricts access to two C class networks and
# the "loopback" interface. For more examples of the syntax see
# the smb.conf man page
;   hosts allow = xxx.xxx.xxx.xxx
    hosts allow = IP
...
...
 
[homes]
   comment = Home Directories
   browseable = no
   writeable = yes
   valid users = %S
[pds]
   comment = Public Stuff
   path = /usr/local/down
   public = yes
   writable = yes
   create mask = 0777
 
cd /usr/local/etc/rc.d
 
cp samba.sh.sample samba.sh
 
vi samba.sh
 
#!/bin/sh
rc_file=${0##*/}
if ! PREFIX=/usr/local; then                                          <=== 수정
        echo "${rc_file}: Cannot determine PREFIX." >&2
        echo "Please use the complete pathname." >&2
        exit 64
fi
smbspool=/var/spool/samba
pidfiledir=/var/run
smbd=${PREFIX}/sbin/smbd
nmbd=${PREFIX}/sbin/nmbd
# start
if [ "x$1" = "x" -o "x$1" = "xstart" ]; then
        if [ -f $smbd ]; then
                if [ -d $smbspool ]; then
                        rm -f $smbspool/*
                fi
                echo -n ' Samba'
                $smbd -D
                $nmbd -D
        fi
# stop
elif [ "x$1" = "xstop" ]; then
        kill `cat $pidfiledir/smbd.pid`
        kill `cat $pidfiledir/nmbd.pid`
fi
 
./samba.sh start
 
smbuser 생성
 
cd /usr/local/bin/
 
./smbpasswd [username]
 
New SMB password:
Retype new SMB password: