教學: 安裝檔案, 印表機分享伺服器, Samba Server | Tutorial: Install File and printer sharing server, Samba Server

March 18, 2009 at 6:48 pm | Posted in Uncategorized | Leave a comment
Tags: , , , , , , , , , ,

前言:

如果在辦公室裡, 要分享檔案和印表機, 可以用Windows的分享設定, 但是說到好用和穩定, 個人會覺得Samba更好用, 在這裡為大家寫寫怎樣安裝和配置一個好用又安全的Samba伺服器.

安裝:

在命令行中:

# sudo apt-get install samba

# sudo apt-get install libpam-smbpass smbclient

這樣系統就會自動下載和安裝Samba.

建立一個文件夾來放置分享的檔案:

# cd /home

# sudo mkdir company-share

# sudo chmod 0777 company-share

基本設置:

# sudo gedit /etc/samba/smb.conf

[global]

workgroup = Company

server string = %h server

map to guest = Bad User

obey pam restrictions = Yes

passdb backend = tdbsam

pam password change = Yes

passwd program = /usr/bin/passwd %u

passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .

unix password sync = Yes

syslog = 0

log file = /var/log/samba/log.%m

max log size = 1000

printcap name = cups

dns proxy = No

usershare allow guests = Yes

panic action = /usr/share/samba/panic-action %d

invalid users = root

[printers]

comment = All Printers

path = /var/spool/samba

create mask = 0700

printable = Yes

browseable = No

[print$]

comment = Printer Drivers

path = /var/lib/samba/printers

[Company-Share]

comment = Internal File Sharing

path = /home/company-share

read only = No

delete readonly = Yes

create mask = 0777

directory mask = 0777

以上的設置基本上已經夠用, 雖然說不上是極度安全, 但是起碼要用檔案和印表機的時候也要輸入密碼. 如果在跑Samba Server的機器上沒有帳戶的, 那麼一般的人都是進不去, 用不了. 如果有人想用這些服務, 可以在機器上開創一個用戶, 他就可以用啦. Linux的密碼和Samba的密碼已經同步了, 所以登入只要用Linux的密碼就可以. 如果密碼更改了, Samba的也會跟著改.

最後:

謝謝觀賞!

Advertisement

Leave a Comment »

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Blog at WordPress.com. | Theme: Pool by Borja Fernandez.
Entries and comments feeds.

Follow

Get every new post delivered to your Inbox.