Samba swings both ways

By  

For mounting Windows shares on Linux, you also need cifs-utils package.

Once the packages are installed, you need to adjust your firewall settings, assuming iptables is running. This means opening up the ports that Samba requires -- UDP ports 137 and 138, and TCP ports 139 and 445. These ports will respectivly support netbios-ns, netbios-dgm, netbios-ssn and microsoft-ds. You can open these ports for everyone by adding commands like these to your /etc/sysconfig/iptables file:

-A INPUT -m state --state NEW -p UDP --dport 137 -j ACCEPT
-A INPUT -m state --state NEW -p UDP --dport 138 -j ACCEPT
-A INPUT -m state --state NEW -p TCP --dport 139 -j ACCEPT
-A INPUT -m state --state NEW -p TCP --dport 445 -j ACCEPT

Alternately, you can restrict access to a particular subnet by adding the subnet to the commands like this:

-A INPUT -m state --state NEW -p UDP -s 192.168.0.0/24 --dport 137 -j ACCEPT
-A INPUT -m state --state NEW -p UDP -s 192.168.0.0/24 --dport 138 -j ACCEPT
-A INPUT -m state --state NEW -p TCP -s 192.168.0.0/24 --dport 139 -j ACCEPT
-A INPUT -m state --state NEW -p TCP -s 192.168.0.0/24 --dport 445 -j ACCEPT

Once these commands are added to your iptables configuration file (/etc/sysconfig/iptables), you need to restart iptables. On Fedora and RedHat systems, this is done with the command systemctl restart iptables.service.

You will also need to establish passwords for your samba users. There are actually several ways to do that these days, but the default is to use tdbsam. Look for the passdb backend setting in your /etc/samba/smb.conf file to see your setting. Keep in mind that lines starting with # or ; are inactive.

# grep passdb /etc/samba/smb.conf
	passdb backend = tdbsam

You can add each user who needs access to Samba shares on their Windows system with the smbpasswd command (e.g., smbpasswd -a sbob). The password will be added to passdb.tdb (/var/lib/samba/private/passdb.tdb) on some Linux systems.

Of course, you need to decide what you're doing to be sharing from the Linux side and make the needed changes to /etc/samba/smb.conf. For home directories, you'll use something like this:

[homes]
   comment = Home Directories
   browseable = no
   read only = no
   create mode = 0750

You can add other directories as needed.

Join us:
Facebook

Twitter

Pinterest

Tumblr

LinkedIn

Google+

Answers - Powered by ITworld

Join us:
Facebook

Twitter

Pinterest

Tumblr

LinkedIn

Google+

Ask a Question