サーバー設定 · 3 min read · Dec 11, 2025
SAMBA (ドメインコントローラー) サーバー 小規模作業グループ用 Ubuntu 7.10 - ページ 2
SAMBA サーバー
apt-get install libcupsys2 samba samba-common samba-doc smbclient winbind cupsys-common/etc/samba/smb.conf を次のように編集します:
vi /etc/samba/smb.conf[global]
workgroup = MYWORKGROUP
netbios name = SERVER1
server string = %h server (Samba, Ubuntu)
passdb backend = tdbsam
security = user
username map = /etc/samba/smbusers
name resolve order = wins bcast hosts
domain logons = yes
preferred master = yes
wins support = yes
# 印刷のために CUPS を設定
load printers = yes
printcap name = CUPS
printing = CUPS
# デフォルトのログオン
logon drive = H:
logon script = scripts/logon.bat
logon path = \\server1\profile\%U
# ユーザー追加スクリプト
# add user script = /usr/sbin/adduser --quiet --disabled-password --gecos "" %u
add user script = /usr/sbin/useradd -m '%u' -g users -G users
delete user script = /usr/sbin/userdel -r %u
add group script = /usr/sbin/groupadd %g
delete group script = /usr/sbin/groupdel %g
add user to group script = /usr/sbin/usernod -G %g %u
add machine script = /usr/sbin/useradd -s /bin/false/ -d /var/lib/nobody %u
idmap uid = 15000-20000
idmap gid = 15000-20000
template shell = /bin/bash
# smb パスワードを Linux パスワードと同期
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\sUNIX\spassword:* %n\n *Retype\snew\sUNIX\spassword:* %n\n *password\supdated\ssuccessfully* .
passwd chat debug = yes
unix password sync = yes
# ログレベルを設定
log level = 3
[public]
browseable = yes
public = yes
[homes]
comment = Home
valid users = %S
read only = no
browsable = no
[printers]
comment = All Printers
path = /var/spool/samba
printable = yes
public = no
writable = no
create mode = 0700
[print$]
comment = Printer Drivers
path = /var/lib/samba/printers
browseable = yes
read only = yes
guest ok = no
write list = root, @smbadmin
[netlogon]
comment = Network Logon Service
path = /home/samba/netlogon
admin users = Administrator
valid users = %U
read only = no
guest ok = yes
writable = no
share modes = no
[profile]
comment = User profiles
path = /home/samba/profiles
valid users = %U
create mode = 0600
directory mode = 0700
writable = yes
browsable = no
guest ok = no
ドメインログオンとプロファイル用のディレクトリを作成します:
mkdir /home/samba
mkdir /home/samba/netlogon
mkdir /home/samba/profiles
chmod 777 /var/spool/samba/
chown -R root:users /home/samba/
chmod -R 771 /home/samba/これで Samba を再起動します:
/etc/init.d/samba restart/etc/nsswitch.conf を編集します。行を変更します:
vi /etc/nsswitch.confhosts: files dnsを:
hosts: files wins dnsサーバーの /etc/hosts ファイルに作業グループのすべてのコンピュータを追加します。
vi /etc/hosts192.168.0.100 server1 server1.example.com
192.168.0.110 workstation1
192.168.0.111 workstation2
192.168.0.112 workstation3
192.168.0.113 workstation4root ユーザーを SAMBA パスワードデータベースに追加します。root ユーザー (エイリアス: Administrator) は私たちのドメイン管理者になります。このアカウントは新しいコンピュータを SAMBA ドメインに追加するために必要です。
smbpasswd -a rootファイル /etc/samba/smbusers を作成し、次の行を追加します:
echo "root = Administrator" > /etc/samba/smbusersこれにより、一般的な Windows ユーザー名 “Administrator” を Linux の root ユーザーのエイリアスとして使用できるようになります。
これで設定が正しいかテストします:
smbclient -L localhost -U%出力は次のようになります:
Domain=[MYWORKGROUP] OS=[Unix] Server=[Samba 3.0.26a]
Sharename Type Comment
--------- ---- -------
IPC$ IPC IPC Service (samba server (Samba, Ubuntu))
netlogon Disk Network Logon Service
print$ Disk Printer Drivers
Domain=[MYWORKGROUP] OS=[Unix] Server=[Samba 3.0.26a]
Server Comment
--------- -------
SERVER1 samba server (Samba, Ubuntu)
Workgroup Master
--------- -------
MYWORKGROUP SERVER1
WORKGROUP FILESERVERWindows 用のデフォルトのドメイングループを設定します:
net groupmap add ntgroup="Domain Admins" unixgroup="root" type=domain -U root
net groupmap add ntgroup="Domain Users" unixgroup="users" type=domain -U root
net groupmap add ntgroup="Domain Guests" unixgroup="nogroup" type=domain -U rootSAMBA ドメインにユーザーを追加
これで、ユーザー “tom” を Samba ドメインに追加します。この SAMBA ドメインサーバーに接続したい各ユーザーアカウントについて、このようにユーザーを追加する必要があります。
ユーザー “tom” をパスワード “secret” で Samba および Linux ユーザーデータベースに追加します:
net rpc user add tom -U root
net rpc user password tom "secret" -U root
smbpasswd -e tom共有の追加
これで、すべてのユーザーがアクセスできる共有を追加します:
mkdir -p /home/shares/allusers
chown -R root:users /home/shares/allusers/
chmod -R ug+rwx,o+rx-w /home/shares/allusers/ファイル /etc/samba/smb.conf の最後に次の行を追加します:
[allusers]
comment = All Users
path = /home/shares/allusers
valid users = @users
force group = users
create mask = 0660
directory mask = 0771
writable = yes
これで Samba を再起動します:
/etc/init.d/samba restartCUPS のインストール
apt-get install cupsys cupsys-client cupsys-driver-gimpprint defoma fontconfig foomatic-db foomatic-filters libcupsimage2 libexpat1 libfontconfig1 libfreetype6 libjpeg62 libpaper1 libpng12-0 libslp1 libtiff4 patch perl perl-modules ttf-bitstream-vera ucf私のワークステーション (IP 192.168.0.70) から Web インターフェースにアクセスするために、CUPS をサーバー IP でリッスンし、IP 192.168.0.70 からのアクセスを許可するように設定します。この IP はネットワーク構成に合わせて変更する必要があります。
vi /etc/cups/cupsd.conf行を変更します:
Listen localhost:631を:
Listen 192.168.0.70:631および:
# 管理ページへのアクセスを制限...
Order allow,deny
Allow localhost
を:
# 管理ページへのアクセスを制限...
Order allow,deny
Allow 192.168.0.70
そして CUPS デーモンを再起動します:
/etc/init.d/cupsys restartCUPS Web インターフェースは、私のワークステーションから任意の Web ブラウザでアクセス可能です:
http://192.168.0.100:631/これで、ユーザー名 root と私の root パスワードで CUPS インターフェースにログインできます。
注意: プリンタ用の Linux ドライバが利用できない場合、SAMBA 経由で Windows ワークステーションからのみこのプリンタを使用したい場合は、プリンタメーカーの “RAW” を使用し、Windows ワークステーションに正しいドライバをインストールできます。
CUPS で新しいプリンタを作成した場合、次のコマンドで Samba に追加する必要があります:
cupsaddsmb -aこのハウツーは、すべての HowtoForge 購読者向けに VMware 仮想マシンイメージとしても利用可能です。
リンク
すべての商標はそれぞれの所有者に帰属します。
新しい投稿を受信箱で受け取る
スパムはありません。いつでも購読を解除できます。