Step by Step Process to Setup Samba to Share Folders with Windows Machine
I am happy to help you here with the step by step process. But, I would suggest you go through the docs available on CentOS or Samba website. Those are for brush-up and what more you can do with Samba. As of with any Unix program, you can do much more than it appears with Samba. That's the beauty of Unix and one of the reasons of me being in love with it. Okay, before I get carried away, let me post the steps that need to be done by you to setup Samba. I am assuming you are sharing /share folder on the CentOS server.
Here you go:
1. Install Samba package:
2. Install Samba Client too, for using smbclient program for troubleshooting purposes
3. If SELinux is turned on and running in enforcing mode, turn on the following booleans at least:
samba_export_all_ro
samba_export_all_rw
You can get a full list of booleans related to Samba by the following command:
Prepare the share directory with appropriate SELinux context to avoid AVC denials:
4. If IPtables is running on the server, add the following lines in your /etc/sysconfig/iptables before the entries for FORWARD chain starts:
Now, restart the iptables service:
5. Now, it's time to dive into the config file of samba. Open /etc/samba/smb.conf file with your favorite editor and make the following changes in the [global] directive:
Please ensure you mention the correct NIC in place of eth0 through which you will be sharing the folders. Now, I have customized it depending upon your needs. "security = share" will enable anonymous mode because of which you won't be prompted for a username/password while accessing the share. If you select "security = user" or "security = domain" when target client machines are Windows and a member of Active Directory domain, believe me, you will spend at least next 48 hours without sleeping to troubleshoot subsequent permission issues. I know it very well!!
6. Create a directive like [share] for an example to share /share folder:
You need to do this for each of your shares. Remember, the directive should of unique name.
7. Now, for anonymous access, samba maps the "nobody" built-in user and group with the same name by default. So, to make sure whoever accesses this share, gets to read/write/exec, you need to make nobody as the owner of the folder:
Wait! What did I just do? The first command makes nobody user and nobody group as the owner of the /share folder and the subsequent files/folders.
The second line gives read+write+execute permission to the owner and the group to /share and files/folders beneath it. Now the twist; the number 4 turns on the SGID bit, for which, whenever someone creates a file/folder in the /share or in any directory beneath it, that file/folder gets the group permission enabled automatically. In turn, anybody can see/modify the new file/folder without having you to setup the permission on them manually. This saves a lot of time and SGID bit should be enabled when it comes to collaboration sharing.
8. Did I just forget to start the samba server now? Nope. You are all set now. So, fire up the samba server:
Now, go to your Windows 2003 server and map the share with "\\10.1.2.3\share" path. You can map it as a network drive as well.
This would be all you need to accomplish your goal. Samba is a complex thing and you would spend a lot of time checking its logs or troubleshooting if you do not spend time checking out the documents. No shortcuts!!
Hi,
i have a server installed samba+openldap (pdc). Need to migration windows server 2003 (active directory) object users, computers.
Where you can read how to do it? Or can tell me how to do it?
Thanks.
P.S. Sorry for bad english (0 Replies)
Hi,
I have generated a Public/Private Key Pair in Solaris Unix (source) server and deployed the Public key in Windows 2003(target) server .ssh directory of user profile.
When i try to connect(ssh, scp, sftp) from Unix, i'm getting below error message.
Sun_SSH_1.1, SSH protocols 1.5/2.0,... (0 Replies)
Hi everybody...
I want to sync files between unix client machine and windows 2003 server machine.
I thought of using Cygwin for windows server and then rsync between two to sync files, but have come to know that might be Cygwin will not be able to handle multiple clients request....
Can any... (2 Replies)
Hi All,
I am trying to connect from Unix machine to Windows 2003 server using passphrase method. It is connecting to the server and the connection is immediately closing. Below is the stack trace. Can anyone let me know what wrong with it?
cwadmin@iut1wps1:/home/cwadmin> ssh username@targetip... (1 Reply)
Hello everybody .. i want connect with smbclient to an windows server 2003 with active directory. Exist a version of samba that can do this?
Thank you very much for your time.
Good Luck :b: (3 Replies)
Hi,
Anybody knows how to map a particular server directory to another server directory. Both servers are unix. For example when i view the files in server A /export/home/web/doc/ , I am actually viewing the files in server B /export/home/web/doc. Have been looking for a solution for a long time.... (2 Replies)
Hello All,
I need your help with this, i appreciate all your help that you can give.
Windows NT Domains
Connect Windows XP as a domain client to both systems, Windows Server 2003 and Unix.
Secure shell
Set up secure shell on Linux (ssh). Set up secure client on Windows XP. Putty?
I... (1 Reply)
We have a Windows Server 2003 box and I'd like to share a drive with a Sun Solaris box so that the Sun Solaris box can copy files to/from the Windows Server 2003.
I believe that Windows Services for UNIX 3.5 will allow me to do this, can anyone comfirm this ?
Also, any links on how to... (1 Reply)
hi all ;;
I have a Tru64 UNIX machine , first i want my employees ( windows clients) to see specific directory on unix , and how can i put a unix command in a visual basic code to copy the contents of that directory to drive c in the client side who request that by clicking a push button.
... (3 Replies)