map unix directory to Windows 2003 server


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users map unix directory to Windows 2003 server
# 8  
Old 10-26-2011
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:
Code:
[root@genserv-sl6 ~]# yum install samba

2. Install Samba Client too, for using smbclient program for troubleshooting purposes
Code:
[root@genserv-sl6 ~]# yum install samba-client

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
Code:
[root@genserv-sl6 ~]# setsebool -P samba_export_all_ro on
[root@genserv-sl6 ~]# setsebool -P samba_export_all_rw on

You can get a full list of booleans related to Samba by the following command:
Code:
[root@genserv-sl6 ~]# getsebool -a | grep samba

Prepare the share directory with appropriate SELinux context to avoid AVC denials:

Code:
[root@firewal-el6 ~]# semanage fcontext -a -t samba_share_t "/share(/.*)?"
[root@firewal-el6 ~]# restorecon -Rv /share

4. If IPtables is running on the server, add the following lines in your /etc/sysconfig/iptables before the entries for FORWARD chain starts:
Code:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 111 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 111 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 445 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT

Now, restart the iptables service:
Code:
[root@firewal-el6 ~]# service iptables restart

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:
Code:
        workgroup = WORKGROUP
        server string = Samba Server Version %v
        netbios name = MYSERVER
        interfaces = lo eth0
        security = share

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!! Smilie

6. Create a directive like [share] for an example to share /share folder:

Code:
[share]
        comment = CentOS Share
        path = /share/
        public = yes
        writable = yes
        printable = no
        guest only = yes
        guest ok = yes
        browsable = yes


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:

Code:
[root@firewal-el6 ~]# chown -R nobody:nobody /share
[root@firewal-el6 ~]# chmod -R 4770 /share

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:

Code:
[root@firewal-el6 ~]# service smb start

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!! Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX and Linux Applications

Server migration from samba+ldap to windows server 2003

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)
Discussion started by: ap0st0l
0 Replies

2. Shell Programming and Scripting

Error copying files from Unix (Solaris10) to Windows Server 2003 using scp/sftp

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)
Discussion started by: ajaykumarb
0 Replies

3. UNIX for Dummies Questions & Answers

Sync files between unix client and windows 2003 server

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)
Discussion started by: lokeshsingla
2 Replies

4. Shell Programming and Scripting

sftp Connection from Unix to Windows 2003 server using Passphrase

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)
Discussion started by: vijayin
1 Replies

5. Solaris

Connect smbclient to an windows server 2003 with active directory

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)
Discussion started by: enkei17
3 Replies

6. Shell Programming and Scripting

map windows server to unix server

How to map the windows server to tenet/unix server an dget the files in the windows server to unix server? (1 Reply)
Discussion started by: vinay123
1 Replies

7. Solaris

Map Unix server directory to another Unix server directory

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)
Discussion started by: sagolo
2 Replies

8. UNIX for Dummies Questions & Answers

Unix and Windows Server 2003

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)
Discussion started by: italia
1 Replies

9. Windows & DOS: Issues & Discussions

Windows Server 2003 file sharing with UNIX

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)
Discussion started by: markgrimes
1 Replies

10. UNIX for Dummies Questions & Answers

Map Drive from UNIX Server to Windows Clients

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)
Discussion started by: kafaween
3 Replies
Login or Register to Ask a Question