您好,登錄后才能下訂單哦!
這篇文章主要介紹“samba服務器怎么安裝”,在日常操作中,相信很多人在samba服務器怎么安裝問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”samba服務器怎么安裝”的疑惑有所幫助!接下來,請跟著小編一起來學習吧!
一,安裝軟件
[root@station10 ~]# yum install -y samba samba-common samba-client system-config-samba
查看安裝的軟件
[root@station10 ~]# rpm -aq | grep samba
samba-3.0.25b-0.el5.4
system-config-samba-1.2.39-1.el5
samba-client-3.0.25b-0.el5.4
samba-common-3.0.25b-0.el5.4
[root@station10 ~]#
[@more@]
二,配置samba,方法有如下三種
1,system-config-samba
2,samba-swat(http://localhost:901)
3, 編輯 smb.conf 文件
三,通過第3中方法配置samba
1, 建立一個共享的文件夾
[root@station10 /]# mkdir /backup
[root@station10 /]# chmod 777 -R /backup
2,在/etc/samba/smb.conf末尾添加:
[backup]
comment = backup
path = /backup
writeable = yes
public = yes
printable = no
3,添加samba用戶
[root@station10 /]# smbpasswd -a root
New SMB password:
Retype new SMB password:
[root@station10 /]# smbpasswd -a back
New SMB password:
Retype new SMB password:
[root@station10 /]#
4,測試語法
[root@station10 /]# testparm /etc/samba/smb.conf
Load smb config files from /etc/samba/smb.conf
Processing section "[homes]"
Processing section "[printers]"
Processing section "[backup]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions
[global]
workgroup = MYGROUP
server string = Samba Server Version %v
passdb backend = tdbsam
cups options = raw
[homes]
comment = Home Directories
read only = No
browseable = No
[printers]
comment = All Printers
path = /var/spool/samba
printable = Yes
browseable = No
[backup]
comment = backup
path = /backup
read only = No
guest ok = Yes
[root@station10 /]# testparm /etc/samba/smb.conf station10.example.com 192.168.0.10
Load smb config files from /etc/samba/smb.conf
Processing section "[homes]"
Processing section "[printers]"
Processing section "[backup]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Allow connection from station10.example.com (192.168.0.10) to homes
Allow connection from station10.example.com (192.168.0.10) to printers
Allow connection from station10.example.com (192.168.0.10) to backup
[root@station10 /]#
5,啟動samba
[root@station10 /]# /etc/init.d/smb start
Starting SMB services: [ OK ]
Starting NMB services: [ OK ]
[root@station10 /]#
6, 在另外一臺機器上測試
[root@station12 ~]# smbclient -L station10 -U 'back%redhat'
Domain=[STATION10] OS=[Unix] Server=[Samba 3.0.25b-0.el5.4]
Sharename Type Comment
--------- ---- -------
backup Disk backup
IPC$ IPC IPC Service (Samba Server Version 3.0.25b-0.el5.4)
back Disk Home Directories
Domain=[STATION10] OS=[Unix] Server=[Samba 3.0.25b-0.el5.4]
Server Comment
--------- -------
Workgroup Master
--------- -------
MYGROUP
[root@station12 ~]#
7,建立文件夾的時候出錯
[root@station12 ~]# smbclient -U 'back%redhat' //station10/backup
Domain=[STATION10] OS=[Unix] Server=[Samba 3.0.25b-0.el5.4]
smb: > ls
. D 0 Fri Oct 17 18:36:04 2008
.. D 0 Fri Oct 17 18:36:05 2008
63483 blocks of size 65536. 17042 blocks available
smb: > mkdir test
NT_STATUS_ACCESS_DENIED making remote directory test
smb: >
8,查看selinux對應的策略
# SELINUX NOTES:
#
# If you want to use the useradd/groupadd family of binaries please run:
# setsebool -P samba_domain_controller on
#
# If you want to share home directories via samba please run:
# setsebool -P samba_enable_home_dirs on
#
# If you create a new directory you want to share you should mark it as
# "samba-share_t" so that selinux will let you write into it.
# Make sure not to do that on system directories as they may already have
# been marked with othe SELinux labels.
#
# Use ls -ldZ /path to see which context a directory has
#
# Set labels only on directories you created!
# To set a label use the following: chcon -t samba_share_t /path
#
# If you need to share a system created directory you can use one of the
# following (read-only/read-write):
# setsebool -P samba_export_all_ro on
# or
# setsebool -P samba_export_all_rw on
#
# If you want to run scripts (preexec/root prexec/print command/...) please
# put them into the /var/lib/samba/scripts directory so that smbd will be
# allowed to run them.
# Make sure you COPY them and not MOVE them so that the right SELinux context
# is applied, to check all is ok use restorecon -R -v /var/lib/samba/scripts
#
#--------------
9,更改selinux的策略
[root@station10 /]# chcon -t samba_share_t /backup
[root@station10 /]# /etc/init.d/smb restart
Shutting down SMB services: [ OK ]
Shutting down NMB services: [ OK ]
Starting SMB services: [ OK ]
Starting NMB services: [ OK ]
[root@station10 /]#
10,繼續建立文件夾測試ok:
[root@station12 ~]# smbclient -U 'back%redhat' //station10/backup
Domain=[STATION10] OS=[Unix] Server=[Samba 3.0.25b-0.el5.4]
smb: > mkdir test
smb: > ls
. D 0 Fri Oct 17 18:44:36 2008
.. D 0 Fri Oct 17 18:36:05 2008
test D 0 Fri Oct 17 18:44:36 2008
63483 blocks of size 65536. 17042 blocks available
smb: >
11,設置簡單共享
更改配置文件security 為 share
security = share
重啟samba服務
[root@station10 ~]# /etc/init.d/smb restart
測試:
[root@station10 ~]# smbclient //station10/backup
Password:
Domain=[MYGROUP] OS=[Unix] Server=[Samba 3.0.25b-0.el5.4]
Server not using user level security and no password supplied.
smb: >
四,samba Client Tools: nmblookup
list specific machine
nmblookup -U WINS_server -R name
list all machines
nblookup *
[root@station12 ~]# nmblookup *
querying * on 192.168.0.255
192.168.0.10 *<00>
192.168.0.12 *<00>
[root@station12 ~]#
五,samba Clients Tools:mounts
The SMB and CIFS file systems are supported by the Linux Kernel
use mount to mount a Samba-shared resource:
mount -t cifs service mountpoing -o option1,option2
例子:
[root@station12 ~]# mount -t cifs //station10/backup /mnt -o username=back
Password:
[root@station12 ~]# mount
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/mapper/VolGroup00-LogVol01 on /home type ext3 (rw)
/dev/sda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
//station10/backup on /mnt type cifs (rw,mand)
[root@station12 ~]#
或者把root用戶加入到samba用戶
[root@station12 ~]# smbpasswd -a root
New SMB password:
Retype new SMB password:
Added user root.
[root@station12 ~]#
[root@station12 ~]# mount -t cifs //station10/backup /mnt
Password:
[root@station12 ~]# mount
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
/dev/mapper/VolGroup00-LogVol01 on /home type ext3 (rw)
/dev/sda1 on /boot type ext3 (rw)
tmpfs on /dev/shm type tmpfs (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
//station10/backup on /mnt type cifs (rw,mand)
[root@station12 ~]#
到此,關于“samba服務器怎么安裝”的學習就結束了,希望能夠解決大家的疑惑。理論與實踐的搭配能更好的幫助大家學習,快去試試吧!若想繼續學習更多相關知識,請繼續關注億速云網站,小編會繼續努力為大家帶來更多實用的文章!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。