Смекни!
smekni.com

Samba (стр. 2 из 2)

User user_name enabled

host:~#

При начальной установке можно использовать скрипт mksmbpasswd.sh, входящий в

комплект поставки.

host:~#chmod +x /usr/src/samba-2.0.4b/source/script/mksmbpasswd.sh

host:~#cat /etc/passwd /usr/src/samba-2.0.4b/source/script/mksmbpasswd.sh > \

/usr/local/samba/private/smbpasswd

host:~#

Пример рабочей конфигурации Primary Domain Controller (клиенты Windows 9x):

используется тип security = user

# Samba config file created using SWAT

# Global parameters

workgroup = MYGROUP

netbios name = ASERVER

server string = DOMAIN Controller

security = user

encrypt passwords = Yes

passwd program = /usr/bin/passwd

log file = /usr/local/samba/var/log.%U

max log size = 50

nt acl support = Yes

time server = Yes

socket options = SO_KEEPALIVE SO_BROADCAST TCP_NODELAY SO_RCVBUF=4096

SO_SNDBUF=4096

load printers = No

character set = KOI8-R

client code page = 866

logon script = %U.bat

logon path = \%N\Profiles\%U

domain logons = Yes

os level = 33

preferred master = Yes

domain master = Yes

dns proxy = Yes

wins proxy = Yes

wins support = Yes

hosts allow = x.x.x.

[homes]

comment = Home Directories

read only = No

create mask = 0600

browseable = No

[netlogon]

comment = Network Logon Service

path = /usr/local/samba/lib/netlogon

guest ok = No

public = No

locking = No

share modes = No

browseable = Yes

[Profiles]

comment = Users' Profiles

path = /usr/local/samba/profiles

read only = No

browseable = No

[Public]

comment = Public

path = /usr/pub

read only = No

create mask = 0650

Всё! Можно запускать:

host:~#/usr/local/samba/bin/smbd -D -d2

host:~#/usr/local/samba/bin/nmbd -D -d2

host:~#

Проведя соответствующие настройки в Network Neighbrohood (такие как enable NT

Domain logon и т.д), можно попробовать зайти в сеть. Для сохранения настроек

user.dat(для Windows 95) или полного User Profile (для Windows 98) нужно

сделать:

host:~#cd /usr/local/samba/profils

host:/usr/local/samba/profiles#mkdir user_name

host:/usr/local/samba/profiles#chown -R user_name:root user_name ; chmod -R 751

user_name

host:/usr/local/samba/profiles#

Добавление участников Samba PDC

Если в сети есть клиенты Windows NT, необходимо произвести некоторые изменения в

конфигурации Samba. Также станция с Windows NT, должна быть включена в Samba

DOMAIN, то есть в smbpasswd должна быть внесена учётная запись mashine account.

Прежде всего создаём Unix-учётную запись (вносим пользователя с user_name =

[netbios_name включаемой в NT DOMAIN рабочей станции]+[$], что-то типа

nt_ws_1$):

host:~#adduser

Login name for new user (8 characters or less) []: netbios_name$

User id fot netbios_name [defaults to next available]:

Initial groups for netbios_name [users]: nobody

netbios_name$'s home directory [/home/netbios_name]: /dev/null

netbios_name$'s shell [/bin/bash]:

netbios_name$'s account expiry date [MM/DD/YY]:

Ok, I'm about to make a new account. Here's what you entered so far:

New login name: netbios_name$

New UID: [Next available]

Initial group: nobody

Additional groups: [none]

Home directory: /dev/null

Shell: /bin/false

Expiry date: [no expiratron]

This is it... if you want to bail it out, hit Control-C. Otherwise, press

ENTER to go ahead and make the account.

Making new account...

Changing the user information for netbios_name

Enter the new value, or press return for the default

Full Name []:

Room Number []:

Work Phone []:

Home Phone []:

Other []:

Changing password for netbios_name

Enter the new password (minimum of 8, maximum of 127 characters)

Please use a combination of upper and lower case letters and numbers.

New password: some_password_will_be_changed_to-"*-in_shadow_files

Re-enter new password: some_password_will_be_changed_to-"*-in_shadow_files

Done...

host:~#

После этого я правил shadow, меняя зашифрованный пароль на "*".

Следуюший шаг - внесение учётной записи машины в smbpasswd:

host:~# /usr/local/samba/bin/smbpasswd -a -m netbios_name

Added interface ip=x.x.x.x broadcast=x.x.x.255 netmask=255.255.255.0

Addedd netbios_name$

Password changed for user netbios__name$

host:~#

Обратите внимание, что имея Unix-учётную запись netbios_name$, при внесении в

smbpasswd используем netbios_name.

Пример рабочей конфигурации Primary Domain Controller (клиенты Windows 9x /

Windows NT):

используется тип security = user

# Samba config file created using SWAT

# Global parameters

workgroup = MYGROUP

netbios name = ASERVER

server string = DOMAIN Controller

security = user

encrypt passwords = Yes

passwd program = /usr/bin/passwd

log file = /usr/local/samba/var/log.%U

max log size = 50

nt acl support = Yes

time server = Yes

socket options = SO_KEEPALIVE SO_BROADCAST TCP_NODELAY SO_RCVBUF=4096

SO_SNDBUF=4096

load printers = No

character set = KOI8-R

client code page = 866

logon script = %U.bat

logon path = \%N\Profiles\%U

domain logons = Yes

os level = 33

preferred master = Yes

domain master = Yes

dns proxy = Yes

wins proxy = Yes

wins support = Yes

hosts allow = x.x.x.

[homes]

comment = Home Directories

read only = No

create mask = 0600

browseable = No

[netlogon]

comment = Network Logon Service

path = /usr/local/samba/lib/netlogon

guest ok = No

public = No

share modes = No

locking = No

browseable = Yes

[Profiles]

comment = Users' Profiles

path = /usr/local/samba/profiles

read only = No

browseable = No

[Public]

comment = Public

path = /usr/pub

read only = No

create mask = 0650

Всё! Можно запускать:

host:~#/usr/local/samba/bin/smbd -D -d2

host:~#/usr/local/samba/bin/nmbd -D -d2

host:~#

После этого следует стандартная процедура подключения Windows NT Workstation к

PDC. Перегружаем Windows NT - можно попробовать зайти!

NT DOMAIN members

Сначала модифицируeтся файл smb.conf. Ниже приведены рабочие конфигурации файл-

и принт-сервера (участников NT DOMAIN).

Файл-сервер (пароли шифрованы и проверяются на указанном сервере, выполняющем

роль Primary DOMAIN controller):

используется тип security = domain.

# Samba config file created using SWAT

# Global parameters

workgroup = MYGROUP

netbios name = FSERVER1

server string = File-server 1

security = DOMAIN

encrypt passwords = Yes

password server = ASERVER

username map = /usr/local/samba/lib/username.map

log level = 2

log file = /usr/local/samba/var/log.%U

nt acl support = Yes

name resolve order = host wins bcast lmhosts

keepalive = 30

lpq cache time = 30

socket options = SO_KEEPALIVE SO_BROADCAST TCP_NODELAY SO_RCVBUF=4096

SO_SNDBUF=4096

load printers = No

character set = KOI8-R

client code page = 866

os level = 30

lm interval = 10

dns proxy = No

wins server = x.x.x.x

hosts allow = x.x.x.

wide links = No

[Public]

comment = Varios files

path =/pub/

read only = No

create mask = 0744

Print-сервер (пароли шифрованы, и проверяются на указанном сервер, выполняющем

роль Primary DOMAIN controller):

используется тип security = domain

# Samba config file created using SWAT

# Global parameters

[global]

workgroup = MYGROUP

netbios name = PSERVER1

server string = Print server

security = DOMAIN

encrypt passwords = Yes

password server = ASERVER

username map = /usr/local/samba/lib/username.map

log level = 2

syslog = 2

log file = /usr/local/samba/var/log.%U

name resolve order = host wins bcast lmhosts

keepalive = 60

lpq cache time = 5

socket options = SO_KEEPALIVE SO_BROADCAST TCP_NODELAY IPTOS_THROUGHPUT

SO_RCVBUF=4096 SO_SNDBUF=4096

load printers = No

os level = 30

wins server = x.x.x.x

hosts allow = x.x.x.

printing = lprng

wide links = No

[hp6p]

print command = /usr/local/bin/lpr -h -r -P%p %s; rm %s

lpq command = /usr/local/bin/lpq -P%p

lprm command = /usr/local/bin/lprm -P%p %j

comment = hp6p Laser Jet

path = /usr/local/samba/spool/hp6p

print ok = Yes

printer name = hp6p

[hp4000n]

print command = /usr/local/bin/lpr -h -r -P%p %s; rm %s

lpq command = /usr/local/bin/lpq -P%p

lprm command = /usr/local/bin/lprm -P%p %j

comment = hp4000n Laser Jet

path = /usr/local/samba/spool/hp4000n

print ok = Yes

printer name = hp4000n

[tek350e]

print command = /usr/local/bin/lpr -h -r -P%p %s; rm %s

lpq command = /usr/local/bin/lpq-P%p

lprm command = /usr/local/bin/lprm -P%p %j

comment = Tektronix 350 ext

path = /usr/local/samba/spool/tek350e

print ok = Yes

printer name = tek350e

Должна существовать Unix-учётная запись в passwd и shadow.

Нужно отметить, что файлы passwd и shadow должны содержать учётные записи

пользователей NT Domain (можно использовать username.map).

passwd:

...

username:x:1016:300:MYGROUP User,,,:/dev/null:/dev/null

...

shadow:

...

username:*:10666:0:99999:7:::

...

Добавление Samba-box в DOMAIN

После окончания конфигурации (при незапущенных демонах smbd и nmbd)

производиться добавление Samba-box в NT DOMAIN (используя Server Manager for

DOMAIN, если PDC - Windows NT Server или рассмотренную выше процедуру). Сначала

на PDC добавляем Samba-box. Далее используем smbpasswd:

host:~#/usr/local/samba/bin/smbpasswd -j MYGROUP -r PDC_netbios_name

Added interface ip=x.x.x.x broadcast=x.x.x.255 netmask=255.255.255.0

YYYY/MM/DD hh:mm:ss : change_trust_account_password:

Changed password for domain MYGROUP.

Joined domain MYGROUP.

host:~#

Можно запускать!

host:~#/usr/local/samba/bin/smbd -D -d2

host:~#/usr/local/samba/bin/nmbd -D -d2

host:~#