Talk:Samba


 * http://freebsdwiki.org/index.php/Samba_Configuration
 * http://learnlinux.tsf.org.za/courses/build/net-admin/ch08s02.html
 * http://www.ece-help.gatech.edu/faq/smbclient.html
 * про монтирование http://sig9.com/articles/samba-automount-freebsd

mars # netstat -an Active Internet connections (including servers) Proto Recv-Q Send-Q Local Address          Foreign Address        (state) tcp4      0      0  192.168.0.254.139      *.*                    LISTEN tcp4      0      0  192.168.0.254.445      *.*                    LISTEN

Получение и закачка файла: smbclient \\\\mars\\Dev Password:  Domain=[NEHOME] OS=[Unix] Server=[Samba 3.0.28] Server not using user level security and no password supplied. smb: \> ls .                                  D        0  Sat May 30 15:53:50 2009 ..                                 D        0  Sat May 30 15:14:23 2009 caricino.exe                       A 121813808  Mon Feb  2 14:21:08 2009

57678 blocks of size 16777216. 35350 blocks available smb: \> get caricino.exe  getting file \caricino.exe of size 121813808 as caricino.exe (21960.3 kb/s) (average 21960.3 kb/s)

smb: \> put igmpproxy- нажата клавиша TAB<BR> igmpproxy-freebsd-06122008.tar.gz igmpproxy-install-complete/   <BR> smb: \> put igmpproxy-freebsd-06122008.tar.gz <BR> putting file igmpproxy-freebsd-06122008.tar.gz as \igmpproxy-freebsd-06122008.tar.gz (430.0 kb/s) (average 430.0 kb/s)<BR>

Просмотр доступных сервисов на конкретном сервере: smbclient -L \\\\mars Password: <BR> Domain=[NEHOME] OS=[Unix] Server=[Samba 3.0.28]<BR> <BR> Sharename      Type      Comment<BR> -            ---<BR> Family         Disk      Family photos and videos<BR> Media          Disk      Video, Music, Etc<BR> Image          Disk      CD Images<BR> Dev            Disk      Local developer studio<BR> Etc            Disk      Etc for Local developer studio<BR> IPC$           IPC       IPC Service (NAS)<BR> Domain=[NEHOME] OS=[Unix] Server=[Samba 3.0.28]<BR> <BR> Server              Comment<BR> -           ---<BR> MARS                NAS<BR> <BR> Workgroup           Master<BR> -           ---<BR> NEHOME              MARS<BR>

Сетевое окружение: smbtree Password: <BR> NEHOME<BR> \\MARS                         NAS<BR> \\MARS\IPC$            IPC Service (NAS)<BR> \\MARS\Etc             Etc for Local developer studio<BR> \\MARS\Dev             Local developer studio<BR> \\MARS\Image           CD Images<BR> \\MARS\Media           Video, Music, Etc<BR> \\MARS\Family          Family photos and videos<BR>

Монтирование samba-ресурсов (приходится в поле пароль нажимать Enter). Это штатный компонент ОС. Password:<BR> mars# ls /mnt/<BR> caricino.exe                           igmpproxy-freebsd-06122008.tar.gz<BR>
 * 1) mount_smbfs //MARS/Dev /mnt/

Чтобы не запрашивало пароль: ~/.nsmbrc со следующим содержимым: [NAS05:VIVEK]<BR> password=myPassword<BR> И монтирование производить с ключом -N mount_smbfs -N -I 192.168.0.254 //vivek@nas05/data /nas05

You have to be root to mount filesystems in FreeBSD, or to copy over files across the share. I have not yet found a workaround for this. Keep su handy, that helps.

Монтирование при запуске ОС: <PRE> /etc/fstab //EDWARD at CHAOS/SHARE	/mnt/chaos	smbfs	rw,noauto	0	0

To specify your username and password for the mount, you should create /etc/nsmb.conf the syntax for this file is shown in /usr/share/examples/smbfs/dot.nsmbrc

Here is an example from my machine:

[CHAOS] addr=10.0.3.3
 * 1) nsmb.conf

[CHAOS:EDWARD] password=XXXXXXXXX

Finally, to mount on bootup, create a file in /usr/local/etc/rc.d with the following contents (or something similar; you probably didn't name your share CHAOS):

-edward at interface$ more /usr/local/etc/rc.d/010.chaos.sh
 * 1) ! /bin/sh

case "$1" in

start)               echo "  Mounting CHAOS..."                mount /mnt/CHAOS &>2                ;;

stop)               echo "  Unmounting CHAOS..."                umount /mnt/CHAOS &>2                ;;

esac

Also, I make sure my /etc/nsmb.conf file is owned by root and chmod'ed 600 because it contains a password in plaintext.

Don't forget to make sure that your file in /usr/local/etc/rc.d is chmodded at least 700 so that it's executable by, at the very least, the owner (should be root).

Показывает группу, мастербраузер (где?) и пользователей, залогиненных на данный сервис: nmblookup -A 192.168.0.254 Looking up status of 192.168.0.254<BR> MARS           <03> -         B <ACTIVE> <BR> MARS           <20> -         B <ACTIVE> <BR> MARS           <00> -         B <ACTIVE> <BR> ..__MSBROWSE__. <01> - <GROUP> B <ACTIVE> <BR> NEHOME         <00> - <GROUP> B <ACTIVE> <BR> NEHOME         <1b> -         B <ACTIVE> <BR> NEHOME         <1d> -         B <ACTIVE> <BR> NEHOME         <1e> - <GROUP> B <ACTIVE> <BR> <BR> MAC Address = 00-00-00-00-00-00<BR>