![]() |
| ||
| How to Configure Samba on RedHat Linux What's Samba? Samba allows linux computers to share files and printers across a network connection. By using its SMB protocol, your linux box can appear in Windows Network Neighborhood or My Network Places just like any other windows machine. You can share files this way, as well as printers. By using samba on my home network, for example, my Windows machines have access to a printer directly hooked up to my Linux box, and my Linux box has access to a printer directly hooked up to one of my Windows machines. In addition, everyone can access everyone else's shared files. You can see how samba can be very useful if you have a network of both Windows as well as Linux machines. Samba configurations are slightly different depending on the distribution you're using. Therefore, this tutorial explains how it's done on a RedHat Linux machine, as this is my distro of choice, and the only one I've ever installed samba on. The following method has been used by me on RedHat 7.2, 7.3, and 8. Installing Samba The first step to configuring samba is, obviously, to make sure that it's installed. In most cases, this will already be the case. It is often a good idea to install the samba daemon package with the RedHat installation. You can test to see if samba is installed by typing rpm -q samba in a terminal. This performs a query on the samba package. If installed, it will indicate the version. If not, it will indicate "package not installed". If samba is not currently installed, there are a multitude of places to get it. The RPM package is available on the RedHat CDs, on the RedHat network, or straight from www.samba.org or one of the samba mirror sites. In addition, you might wish to find it at www.rpmfind.net, a nice resource for RPM packages. Once you have the samba RPM package downloaded somewhere on your harddrive, it's time to install it. Browse to where the file is located and perform one of the following two operations: if samba is not currently installed,Now that samba is installed, we can work on configuring this program. smb.conf file All of samba is configured in one single file, the smb.conf file. This file, located at /etc/samba/smb.conf, allows you to specify which resources on the linux machine you wish to share and who they can be accessed by. A fresh installation of samba will include a sample smb.conf file. This file is completely commented, pointing out all of your available options, and how you can change them. However, samba is an extremely powerful tool, and most casual users have no need for 3/4 of the contents of this sample file. Therefore, I'm providing my own smb.conf file below. If you wish to just share a few folders across a small home LAN, you might be better off basing your own smb.conf file off of mine, as opposed to the long-winded sample file. [global]Samba Users Since we're using user level security (the best option when connecting to a WinNT based machine, such as Windows 2000 or Windows XP), we need to set up samba users. First, lets create the smbpasswd file that we defined in the smb.conf file. The best way to go about this is to create it based on your existing /etc/passwd file. In other words, samba users are created based on existing linux users: cat /etc/passwd | mksmbpasswd.sh > /etc/samba/smbpasswdChmod 600 this file (/etc/samba/smbpasswd) so that only root has read and write permissions. However, this file only copies over Linux users to samba users. It doesn't copy over their passwords, as well. Therefore, use the following command to set each samba user's password: smbpasswd usernameObviously, replace username with each of your user's usernames. You will then be prompted to enter a password for this user account. I like to set my samba user's passwords the same as their linux user counterparts. However, this isn't necessary. Samba Service Now that everything has been configured, the final step is to start the samba service. Samba runs in the background as a linux daemon. Therefore, it can be controlled by typing: service smb startNote that once the computer is restarted or shutdown, the samba service won't start up again the next time. I use the GUI (xwindows) program serviceconf to set up all my services to execute automatically. Connecting To A Samba Resource Now that everything should be working, let's test it out. We use the samba client to connect to a samba resource. For testing purposes, we can connect to localhost. smbclient //localhost/DownloadsYou must specify the name of the computer as well as the resource you wish to connect to. In this case, I can connect to the Downloads resource because I specified this resource in my smb.conf file (note it points to /home/windisk/Downloads). Since you are using the samba client while already logged in as a linux user, you will only be prompted for a password. The username will be assumed to be the samba counterpart of the linux username you're currently logged in as. If you wish, you can go to a Windows machine such as Windows XP. If you open My Network Places, and browse to your workgroup, your linux machine should be listed. When trying to access it, you should be prompted with a username and password. This can be any of the samba users you previously created. Once logged in, you should see a listing of all available resources available. Congratulations! Samba should now successfully be set up and working on your network! |
| ||
| Re: How to Configure Samba on RedHat Linux Two further Samba references, although parts of them might be out of date: O'Reilly's Using Samba Samba/SWAT configuration help. Swat (Samba Web Administration Tool) is a popular GUI front-end for Samba configuration. Webmin, although not limited to Samba configuration, is another popular GUI config tool. *Note: When reading documentation concerning Samba/SWAT, watch out for references to inetd. In most cases, that material applies only to older distros, as inetd is deprecated, and has been replaced by xinetd (which has an entirely different config structure). Also, for a Linux equivalent to Windows' "Network Neighborhood/ My Network Places" network browsers, check out LinNeighborhood. |
| ||
| Re: How to Configure Samba on RedHat Linux Man, where was this about 3 months ago when I needed it! UGH! Oh well. You guys do a good job. |
| ||
| Re: How to Configure Samba on RedHat Linux Heya, I used your guide as a reference after encountering problems. Now I'm connecting just fine from my apple even copying files to and from, but it won't let me make or manipulate subfolders inside my share. Any ideas as to what is going wrong? |
| ||
| Re: How to Configure Samba on RedHat Linux chmod 777 /path/to/samba/share provided you want everyone to have read+write access man chmod for more info about assigning attributes to a directory/file |
| ||
| Re: How to Configure Samba on RedHat Linux I used your config file but I had to change one thing to make things work on my network. I had to add: [global] netbios name = yourServerName Before that, the Server was showing up as localHost and said that I had a duplicate name on the network and I couldn't access the share. Thanks for all the help otherwise!!! |
| ||
| Re: How to Configure Samba on RedHat Linux Hello, IF this computer that you have SAMBA installed on is going to be part of the internet, and if this computer is the firewall, then I would strongly suggest that you firewall out the Microsoft ports, before someone tries to attach to your machine via the internet. I would also firewall out any OUTBOUND messages that SAMBA will try to make so that your computer doesn't show up on someone's Network Neighborhood. Inside IPTABLES: ## Explicit drops of Samba ports $IPTABLES -A tcp_packets -p TCP -s 0/0 --dport 139 -j DROP $IPTABLES -A tcp_packets -p TCP -s 0/0 --dport 445 -j DROP $IPTABLES -A udpin_packets -p UDP -s 0/0 --dport 139 -j DROP $IPTABLES -A udpin_packets -p UDP -s 0/0 --dport 445 -j DROP (I have a rule called tcp_packets and udpin_packets. You will have to modify that to fit your IPTABLES firewall. If you are using something else to firewall, take the port numbers and work with it) # Rule Test to drop Microsoft packets outbound from server. # Want to stop Samba Advertising $IPTABLES -A OUTPUT -p TCP -o $INET_IFACE --dport 139 -j DROP $IPTABLES -A OUTPUT -p TCP -o $INET_IFACE --dport 445 -j DROP $IPTABLES -A OUTPUT -p TCP -o $INET_IFACE --dport 32875 -j DROP $IPTABLES -A OUTPUT -p UDP -o $INET_IFACE --source-port 32875 -j DROP $IPTABLES -A OUTPUT -p UDP -o $INET_IFACE --dport 137 -j DROP If anyone needs more help with this, come find me. Christian |
| ||
| Re: How to Configure Samba on RedHat Linux HoWS, We ask that members who have a question start their own thread and post their question in that thread. In that light, I've split your post here into its own thread in the main Linux forum; you can find it here: http://www.daniweb.com/techtalkforum...ead.php?t=7934 |
| ||
| Re: How to Configure Samba on RedHat Linux Cr4nberry, For the reason given in my previous post above, I've split your post into its own thread in the main Linux forum. You can find it here: http://www.daniweb.com/techtalkforums/thread9598.html |
| ||
| Re: How to Configure Samba on RedHat Linux pls help me i have a problem in my pc.it uses red hat linux 9 and i can see it in windows pc but not in linux based pc?what can i do to solved that problem.... thanks!!! |
| All times are GMT -4. The time now is 11:38 pm. |
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC