Previous |
Home | Next |
Version: | - samba 3.0.22 |
[bash]# cp /etc/samba/smb.conf /etc/samba/smb.conf.original [bash]# vi /etc/samba/smb.conf |
[global] workgroup = WORKGROUP netbios name = GALAXY server string = Samba Server |
interfaces = eth1
lo hosts allow = 192.168.1. 127.0.0.1 socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192 |
log file = /var/log/samba/%m.log max log size = 50 |
encrypt passwords = yes smb passwd file = /etc/samba/smbpasswd |
security = user local master = Yes os level = 33 domain master = Yes preferred master = Yes wins support = Yes dns proxy = No passdb backend = smbpasswd passdb expand explicit = No |
create mask = 0644 directory mask = 0755 |
Using
all of the above configurations, the Samba server will now be
configured to
run on the appropriate network and can be seen from your Windows based
clients, however no network shares or user access has been granted yet.
|
[bash]# testparm |
Load smb config files from /etc/samba/smb.conf Loaded services file OK. Server role: ROLE_STANDALONE Press enter to see a dump of your service definitions |
[bash]# chkconfig --level 345
smb on [bash]# chkconfig --list smb |
[bash]# /etc/init.d/smb restart [bash]# tail -n 50 /var/log/messages [bash]# cat /var/log/samba/smbd.log [bash]# cat /var/log/samba/nmbd.log |
If
any of the server's networking parameters have been adjusted, it may
take a few minutes before the server can be seen from the Windows
client after restarting the smb service. |
[bash]# vi /etc/sysconfig/samba |
Man
Pages: |
||
samba |
smb.conf |
smbstatus |
smbd |
smbclient |
findsmb |
nmbd |
smbmount |
testparm |
[bash]# vi /etc/nsswitch.conf |
hosts: files dns wins |
[bash]# useradd -c "Alice Jones" -d /home/alice -s
/sbin/nologin alice |
[bash]# smbpasswd -a alice |
New SMB password: Retype new SMB password: Added user alice. |
[bash]# grep alice /etc/samba/smbpasswd |
alice:4732:01FC5A6BE7BC6929AAD3B435B51404EE:0CB6948805F797BF2A82807973B89537:[U
]:LCT-41CFEFD8: |
[bash]# smbpasswd -x alice |
Deleted user alice. |
[bash]# vi /etc/samba/smb.conf |
[global] username map = /etc/samba/smbusers |
[bash]# vi /etc/samba/smbusers |
# Unix_name = SMB_name1 SMB_name2 ... root = administrator admin nobody = guest pcguest smbguest alice.jones = alice readonly = glen fred terry sarah lachlan = "Lachlan Smith" |
Further details on mapping usernames can be obtained in the
configuration man page, type "man
smb.conf". |
[bash]# vi /etc/samba/smb.conf |
[homes] comment = Home Directory read only = No browseable = No valid users = %S |
[Shared] comment = Global Share - All Users path = /samba/shared read only = No guest ok = Yes public = Yes browseable = Yes create mask = 0666 directory mask = 0777 |
[SmallGroup] comment = Small Share - Few Users path = /samba/smallgroup read only = No guest ok = No browseable = Yes create mask = 0666 directory mask = 0777 valid users = peter, paul, mary |
[Financial] comment = RESTRICTED - Financial Cell path = /samba/financial read only = No guest ok = No browseable = Yes create mask = 0660 directory mask = 0770 valid users = @financial force group = financial |
[FTP-Server] comment = READ ONLY - Corp FTP Server path = /var/ftp read only = Yes guest ok = Yes browseable = Yes create mask = 0755 directory mask = 0755 write list = john, fred force group = ftp force user = ftp |
[WEB-Server] comment = HIDDEN - Corp Web Server path = /var/www/html read only = Yes guest ok = No browseable = No create mask = 0644 directory mask = 0755 write list = fred force group = root force user = root |
[bash]# testparm |
Load smb config files from /etc/samba/smb.conf Processing section "[homes]" Processing section "[Shared]" Processing section "[SmallGroup]" Processing section "[Financial]" Processing section "[FTP-Server]" Processing section "[WEB-Server]" Loaded services file OK. Server role: ROLE_STANDALONE Press enter to see a dump of your service definitions |
If
you would prefer your network printers to only be accessible through
Samba, then CUPS should be configured so only the localhost
(127.0.0.1) has access to the printers. This way print jobs must be
sent to the Samba server, which passes them onto the local CUPS server
on behalf of the user. |
[bash]# vi /etc/samba/smb.conf |
[global] load printers = yes printing = cups printcap name = cups cups options = raw |
[printers] comment = Network Printers path = /var/spool/samba browseable = No public = Yes guest ok = Yes writable = No printable = Yes admin users = @printadmins use client driver = Yes |
[bash]# groupadd printadmins |
[bash]# usermod -G printadmins alice [bash]# usermod -G printadmins bob [bash]# vi /etc/group |
[laser] comment = Brother HL-1430 Laser Printer path = /var/spool/samba admin users = @printadmins read only = No guest ok = Yes printable = Yes printer name = laser use client driver = Yes |
[bubblejet] comment = HP PhotoSmart 7200 Series path = /var/spool/samba admin users = @printadmins read only = No valid users = mary @printadmins printable = Yes printer name = bubblejet use client driver = Yes |
[bash]# testparm |
Load smb config files from /etc/samba/smb.conf Processing section "[homes]" Processing section "[laser]" Processing section "[bubblejet]" Loaded services file OK. Server role: ROLE_STANDALONE Press enter to see a dump of your service definitions |
C:\>net view |
Server
Name
Remark ------------------------------------------------------------------------------- \\GALAXY Server \\WINBOX1 \\WINBOX2 \\WINBOX3 \\WINBOX4 |
C:\>net view \\galaxy |
Shared resources at \\galaxy Share name Type Used as Comment ------------------------------------------------------------------------------- alice Disk Home Directory bubblejet Print Bubblejet - HP PhotoSmart-7260 Financial Disk RESTRICTED - Financial Cell FTP-Server Disk READ ONLY - Corp FTP Server laser Print Laser Printer - Brother HL-1430 Shared Disk Global Share - All Users SmallGroup Disk Small Share - Few Users |
C:\>net use |
New connections will be remembered. Status Local Remote Network ------------------------------------------------------------------------------- OK E: \\galaxy\Financial Microsoft Windows Network OK F: \\galaxy\FTP-Server Microsoft Windows Network OK G: \\galaxy\SmallGroup Microsoft Windows Network |
C:\>net use h: \\galaxy\%username% |
C:\>net use i: \\galaxy\shared |
C:\>net use w: \\galaxy\WEB-Server |
C:\>net use lpt1 \\galaxy\laser C:\>net use lpt2 \\galaxy\bubblejet |
C:\>net use |
OK
H: \\galaxy\alice
Microsoft Windows Network OK I: \\galaxy\Shared Microsoft Windows Network OK W: \\galaxy\WEB-Server Microsoft Windows Network OK LPT1: \\galaxy\laser Microsoft Windows Network |
C:\>net use w: /delete |
C:\>edit login.bat |
@echo off cls echo Mapping Network Resources... echo Mapping: Home Directory net use h: \\galaxy\%username% echo Mapping: Shared Directory net use s: \\galaxy\shared echo Mapping: Laser Printer net use lpt1: \\galaxy\laser echo Mapping: Bubblejet Printer net use lpt2: \\galaxy\bubblejet |
[bash]# findsmb |
*=DMB +=LMB IP ADDR NETBIOS NAME WORKGROUP/OS/VERSION --------------------------------------------------------------------- 192.168.1.1 GALAXY *[MYGROUP] [Unix] [Samba 3.0.10-2] 192.168.1.101 WINBOX1 [WINBOX1] [Windows 5.1] [Windows 2000 LAN Manager] 192.168.1.102 WINBOX2 [WINBOX2] [Windows 5.1] [Windows 2000 LAN Manager] 192.168.1.103 WINBOX3 [WINBOX3] [Windows 5.1] [Windows 2000 LAN Manager] 192.168.1.104 WINBOX4 [WINBOX4] [Windows 5.1] [Windows 2000 LAN Manager] |
[bash]# smbclient -U alice -L
galaxy Password: |
Domain=[GALAXY] OS=[Unix] Server=[Samba 3.0.10-2] Sharename Type Comment --------- ---- ------- Shared Disk Global Share - All Users SmallGroup Disk Small Share - Few Users Financial Disk RESTRICTED - Financial Cell FTP-Server Disk READ ONLY - Corp FTP Server IPC$ IPC IPC Service (Samba Server) ADMIN$ IPC IPC Service (Samba Server) bubblejet Printer HP PhotoSmart 7200 Series laser Printer Brother HL-1430 Laser Printer alice Disk Home Directory Domain=[GALAXY] OS=[Unix] Server=[Samba 3.0.10-2] Server Comment --------- ------- Workgroup Master --------- ------- MYGROUP GALAXY |
[bash]# smbclient -U alice -L
winbox1 Password: |
Domain=[WINBOX1] OS=[Windows 5.1] Server=[Windows 2000 LAN
Manager] Sharename Type Comment --------- ---- ------- E$ Disk Default share IPC$ IPC Remote IPC D$ Disk Default share ADMIN$ Disk Remote Admin C$ Disk Default share Shared Disk Full Share for ALL !!! Domain=[WINBOX1] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager] Server Comment --------- ------- Workgroup Master --------- ------- |
[bash]# smbmount
//winbox1/Shared /media/winbox1/shared -o guest |
[bash]# smbmount //winbox1/C$
/media/winbox1/cdrive -o username=administrator Password: |
[bash]# mount -t smbfs
//winbox1/C$ /media/winbox1/cdrive -o username=administrator Password: |
[bash]# smbmount //winbox1/C$
/media/winbox1/cdrive -o username=administrator,password="secret" |
[bash]# umount
/media/winbox1/cdrive |
[bash]# cat /etc/mtab |
//winbox1/C$ /media/winbox1/cdrive smbfs 0 0 |
[bash]# vi /etc/fstab |
//winbox1/Shared /media/winbox1/shared smbfs noauto,user,username=alice,password=secret 0 0 |
The
file permissions for the /etc/fstab file are world readable, therefore
any local user on the Linux system can view the username and password
combination inside the file. |
Previous |
Home | Next |