I have written a new tool to Setup and Configure Samba which should work on all present supported versions of openSUSE and specifically to work with the new openSUSE 12.3 release.
S.A.C.T. supports the complete and automatic configuration of Samba for use by anyone not familiar with just how to setup Samba the first time to get it to work properly. You should run this setup once on a new system. You need to manually install the samba-doc file from YaST on an existing setup if you are not going to run this S.A.C.T. installation option.
The three Primary Help Documents included with Samba (samba-doc is required) can be viewed in PDF format or in HTML format in your default Web Browser.
S.A.C.T. Has a new Status and testing Menu with smb and nmb log file viewers.
As you make Samba Configuration Changes, you can then Start, Stop, Restart and Check Status of the nmb and smb services at will.
And Finally, S.A.C.T. provides an easy way to create, view and edit the Samba User Database.
What do you see from the desktop to start S.A.C.T.? Here, I select the S.A.C.T. icon in my desktop folder and pick option 5 to edit my smb.conf file. It is just that easy to use.
DOWNLOAD the S.A.C.T. Bash Script:
You can obtain the raw bash script from SUSE Paste at the following link:
S.A.C.T. - Samba Automated Configuration Tool - Version 1.20
Open the above Link in a new Tab. Select the Download option in the top right and then select Open With Kwrite or other text editor and then save the bash script text file as ~/bin/sact. It is possible to directly download sact using the following terminal command (You must delete or remove the old version first):
Code:
rm ~/bin/sact
Code:
wget -nc http://paste.opensuse.org/view/download/60035 -O ~/bin/sact
Code:
chmod +x ~/bin/sact
Code:
rm ~/bin/sact ; wget -nc http://paste.opensuse.org/view/download/60035 -O ~/bin/sact ; chmod +x ~/bin/sact
Code:
sact
SMB and NMB Services:
The smbd (Server Message Block) daemon provides file sharing and printing services to Windows & Samba clients. In addition, it is responsible for user authentication, resource locking, and data sharing through the SMB protocol. The default ports on which the server listens for SMB traffic are TCP ports 139 and 445. If smb is not working, you will be unable to find any PC's, including your own PC, sharing resources on your local network.
The smbd daemon is controlled by the smb service.
The nmbd (NetBIOS Message Block) daemon understands and replies to NetBIOS name service requests such as those produced by SMB/CIFS in Windows-based systems. These systems include Windows 95/98/ME/7/8, Windows NT, Windows 2000, Windows XP, LanManager and Samba clients. It also participates in the browsing protocols that make up the Windows Network Neighborhood view. The default port that the server listens to for NMB traffic is UDP port 137. If nmb is not working and smb is working, you can find other PC's on the network, but no one can find your PC on the network. If smb and nmb are working, you should be able to find what your PC is sharing. Use the S.A.C.T. main menu option six to create a /home sharing icon for your PC on the same PC to see if it is sharing /home properly.
The nmbd daemon is controlled by the nmb and smb services.
HOSTNAME:
To locate your PC on your network, you look for the hostname you have provided. For Samba, you can have a separate name, set in your /etc/samba/smb.conf file or, remark out that line there and use the original hostname as setup in your openSUSE installation, which is recommenced. To see what your actual Computer Name will be, as set by openSUSE during the installation, open up a terminal session and type in the command:
Code:
hostname
Code:
sudo hostname new_name
Code:
su - echo "new_hostname" > /etc/HOSTNAME hostname -F /etc/HOSTNAME
Go to YaST (enter root password) / Network Devices / Network Settings / Hostname/DNS Tab / and enter Hostname, press OK when complete.
What Can You Find Using Samba?
The Samba Setup option then creates a SMB browser icon for you as well:
And When Selected, it will open up a File Browser showing the hostnames of your Samba Compatible Shares:
Samba Configuration:
When you elect to setup Samba for the first time, S.A.C.T. creates a default Samba configuration file called smb.conf and located in the folder named /etc/samba as follows:
Code:
# smb.conf is the main Samba configuration file. # You find a full commented version at # /usr/share/doc/packages/samba/examples/smb.conf.SUSE # if the samba-doc package is installed. # Samba config file created using SWAT # from $netbios_name (127.0.0.1) # Date: $(date) [global] workgroup = $Workgroup # netbios name = $netbios_name passdb backend = tdbsam name resolve order = bcast host lmhosts wins server string = "" printing = cups printcap name = cups printcap cache time = 750 cups options = raw use client driver = yes map to guest = Bad User local master = yes os level = 33 usershare allow guests = Yes usershare max shares = 100 usershare owner only = False [homes] comment = Home Directories valid users = %S, %D%w%S browseable = No read only = No inherit acls = Yes [printers] comment = All Printers path = /var/tmp printable = Yes create mask = 0700 browseable = No guest OK = Yes [print$] comment = Printer Drivers path = /var/lib/samba/drivers write list = @ntadmin root force group = ntadmin create mask = 0664 directory mask = 0775
Your /home folder can not be browsed by default in a file manager. For two or more PC setups using S.A.C.T., see the S.A.C.T. main menu option two to create a /home browse icon you must enter a password to use. To Allow the sharing of a common folder(s) for all users, not requiring a password (from openSUSE as Windows will normally ask for a password), you might make the following addition at the end of your /etc/samba/smb.conf file as follows:
Code:
[Windows] path = /windows/C read only = No acl check permissions = No inherit acls = Yes guest ok = Yes profile acls = Yes use sendfile = Yes
Code:
sudo chmod 777 /windows/C
Code:
/dev/disk/by-id/ata-Hitachi_HDS5C3020ALA632_ML0220F30MGP7D-part2 /windows/C ntfs-3g defaults,noatime 0 0
Code:
sudo mount --all
For added security in using Samba on your home or small network, a couple of added parameters can help insure no communications from outside your local network subnet will be allowed. These next values shown will be added under the Global section (the first group at the top of your /etc/samba/smb.conf file) as:
Code:
hosts deny = ALL hosts allow = 192.168.0.0/255.255.255.0, 127.0.0.1
hosts deny (S)
The opposite of hosts allow - hosts listed here are NOT permitted access to services unless the specific services have their own lists to override this one. Where the lists conflict, the allow list takes precedence.
In the event that it is necessary to deny all by default, use the keyword ALL (or the netmask 0.0.0.0/0) and then explicitly specify to the hosts allow = hosts allow parameter those hosts that should be permitted access.
Code:
Default: hosts deny = # none (i.e., no hosts specifically excluded)
Code:
Example: hosts deny = 150.203.4. badhost.mynet.edu.au
A synonym for this parameter is allow hosts.
This parameter is a comma, space, or tab delimited set of hosts which are permitted to access a service.
If specified in the [global] section then it will apply to all services, regardless of whether the individual service has a different setting.
You can specify the hosts by name or IP number. For example, you could restrict access to only the hosts on a Class C subnet with something like allow hosts = 150.203.5.. The full syntax of the list is described in the man page hosts_access(5). Note that this man page may not be present on your system, so a brief description will be given here also.
Note that the localhost address 127.0.0.1 will always be allowed access unless specifically denied by a hosts deny option.
You can also specify hosts by network/netmask pairs and by netgroup names if your system supports netgroups. The EXCEPT keyword can also be used to limit a wildcard list. The following examples may provide some help:
Code:
Example 1: allow all IPs in 150.203.*.*; except one
Code:
hosts allow = 150.203. EXCEPT 150.203.6.66
Code:
Example 2: allow hosts that match the given network/netmask
Code:
hosts allow = 150.203.15.0/255.255.255.0
Code:
Example 3: allow a couple of hosts
Code:
hosts allow = lapland, arvidsjaur
Code:
Example 4: allow only hosts in NIS netgroup "foonet", but deny access from one particular host
Code:
hosts allow = @foonet
Code:
hosts deny = pirate
See testparm(1) for a way of testing your host access to see if it does what you expect.
Code:
Default: hosts allow = # none (i.e., all hosts permitted access)
Code:
Example: hosts allow = 150.203.5. myhost.mynet.edu.au
If you are using Linux kernel version 3.7 or newer, the Samba protocol SMB2 has been added to the kernel. You can take advantage of this fact by adding in the next value. This next setting shown will be added under the Global section (the first group at the top of your /etc/samba/smb.conf file) as:
Code:
max protocol = SMB2
CORE: Earliest version. No concept of user names.
COREPLUS: Slight improvements on CORE for efficiency.
LANMAN1: First modern version of the protocol. Long filename support.
LANMAN2: Updates to Lanman1 protocol.
NT1: Current up to date version of the protocol. Used by Windows NT. Known as CIFS.
SMB2: Re-implementation of the SMB protocol. Used by Windows Vista and newer. The Samba implementation of SMB2 is currently marked experimental!
Code:
Default: max protocol = NT1
NMB Failing to Start on Reboot:
If, after you restart openSUSE, you notice that no one can find your PC on the network through your Samba share, it may be due to the fact that nmb is not starting. Its possible this is due to a failing of timing by systemd on bootup of your PC. One way to handle that issue to to allow it more time to find your network interfaces.
This is a YaST / System / /etc/sysconfig Editor Setting at:
/ etc / sysconfig / Network / General / WAIT_FOR_INTERFACES Default is 30, but I suggest you select 60 seconds instead and press OK and allow this change to be saved. It will be used then on your next openSUSE PC restart.
CIFS Mount from fstab File Problems:
For more information on using the cifs mount command from your /etc/fstab file, have a look at this guide here: Samba: HowTo Mount a CIFS Network Share [AKA Map Network Drive] in openSUSE 11 plus FAQs
While I am not a fan of having a permanent Samba share mount being made from your fstab file, I do see a lot of folks having a problem with it not working properly when used from the fstab file but it does work from the command prompt. If this is happening to you, then the problem may be due to your network not yet being up when the fstab mounts are executed at boot time. You could test this theory by opening up a terminal after an openSUSE restart and where the cifs mounts did not work and try this command:
Code:
james@LinuxMaster:~> su - Password: LinuxMaster:~ # mount -a LinuxMaster:~ # df Filesystem 1K-blocks Used Available Use% Mounted on devtmpfs 8182504 4 8182500 1% /dev tmpfs 8209780 168 8209612 1% /dev/shm tmpfs 8209780 8148 8201632 1% /run /dev/sdb2 106994728 17296160 84256828 18% / tmpfs 8209780 0 8209780 0% /sys/fs/cgroup tmpfs 8209780 8148 8201632 1% /var/lock tmpfs 8209780 8148 8201632 1% /var/run /dev/sda2 207846992 60684 206729832 1% /Backup /dev/sda4 480834248 203225952 253176680 45% /DataSafe /dev/sda3 264093632 68140372 194879508 26% /home /dev/sdd2 1953153020 62139568 1891013452 4% /Windows /dev/sdc1 1465136124 306207028 1158929096 21% /Multimedia /dev/sde1 1465136124 283431900 1181704224 20% /Software
In order to make a change, we need to being using Traditional Method with ifup. You can switch back to User Controlled by NetworkManager after this change is made:
Next, lets go to the Overview Tab, select your network card and pick the Edit Button at the bottom:
On the General tab make sure the Device Activation is set to: At Boot Time
Once done, select Next and then Done. If you normally use the Network Manager, before you select Done, Go Back and Select the Global Options Tab and select User Controlled with NetworkManager and then press the Done Button.
Additional Resources:
To edit your /etc/fstab file or any system file, have a look at the following blog post.
SYSEdit - System File Editor - Version 1.50: https://forums.opensuse.org/blogs/jd...rsion-1-00-60/
Additional Online Resources can be found here:
1. Index of /samba/docs/man
2. openSUSE SuSE Linux HOWTOs and Tutorials by Swerdna
3. Samba - opening windows to a wider world
As always, if you have any comments, issues or requests, please let me know what they are.
Thank You,
Message