Monday, March 11, 2013

How to configure Samba in Oracle Solaris 10

In the name of Allah, Most Gracious, Most Merciful

Samba comes installed with Oracle Solaris 10. We only have to configure it according to our needs. Following are steps to properly configure samba according to our needs.

You can verify that samba packages are already installed in Oracle Solaris 10 by following command.

1. pkginfo -x | grep -i samba

SUNWsmbac    samba - A Windows SMB/CIFS fileserver for UNIX (client)
SUNWsmbar    samba - A Windows SMB/CIFS fileserver for UNIX (Root)
SUNWsmbau    samba - A Windows SMB/CIFS fileserver for UNIX (Usr)


2. You can check the location of samba config file by following command

pkgchk -l SUNWsmbar | grep conf-example

Pathname: /etc/samba/smb.conf-example

3. Check current state of samba

svcs -a | grep samba

disabled       Feb_22   svc:/network/samba:default

4. Try to enable samba

svcadm enable samba

maintenance    10:27:33 svc:/network/samba:default

It is not enabled, but it is in maintenance mode. You can check the errors encountered while enabling samba by following command.

tail /var/adm/messages

mysystem svc.startd[8]: [ID 652011 daemon.warning] svc:/network/samba:default: Method "/usr/sbin/smbd -D" failed with exit status 1

It means samba failed to start, it most likely due to missing config file.

5. Now copy the sample config file and modify it

cp /etc/samba/smb.conf-example /etc/samba/smb.conf

By default config file is readonly, so make is right able by following command.

chmod 0777 /etc/samba/smb.conf

vi /etc/samba/smb.conf

Add following section in smb.conf file.

[myshare]
comment = My Share
force user = oracle
path = /u01/app/oracle
writeable = no
guest ok = yes


now save file and exit vi.

6. Now change the rights on smb.conf file as before

chmod 0444 /etc/samba/smb.conf

7. Now try to disable samba

svcadm disable samba
svcs -a | grep samba

disabled       10:41:49 svc:/network/samba:default


8. Now try to enable samba again

svcadm enable samba
svcs -a | grep samba

online         10:42:04 svc:/network/samba:default


9. Now set password for oracle user to use "myshare".

smbpasswd -a oracle

10. Now on windows try to map drive

net use O: \\192.168.1.20\myshare

Configuration of samba completes. In-sha-Allah this will help and serve the purpose. For any corrections and improvements please suggest.



27 comments:

  1. Assalamwalikum,


    Very gud article. Thanks for sharing this.

    Asif

    ReplyDelete
  2. extremely useful and works! Thank you..

    ReplyDelete
  3. very precise and accurate.. Thanks for sharing this.

    ReplyDelete
  4. baraka Allahu fik my brother ..... very useful

    ReplyDelete
  5. Simple, straight forward, Excellent!!! Jazakallah Khair..

    ReplyDelete
  6. One of the best article Nazir Bhai...
    Thank you very much ...
    Jazakumullah khair....

    ReplyDelete
  7. Good info. but you can some more info. if samba not installed how install pkg's

    Thanks

    ReplyDelete
  8. Naseer, This is very helpful and useful step. Thanks for sharing this.

    Hi Kim,

    you can install it from solaris OS CD. just go into product and perform the pkgadd

    Thanks

    ReplyDelete
  9. Hi Nasir Bhai,

    This has resolved my problem..

    May Allah bless you with all Happiness..

    --Ravi

    ReplyDelete
  10. Thank you Nasir Zeeshan , your blogspot site is very helpful for me.

    ReplyDelete
  11. Thanks a lot Nasir bhai.
    I am facing few issues after sharing the Solaris folder, Could you please share your email id so that we can discuss over chat?

    ReplyDelete
  12. Assalamualaikum. thanks for the good info brother.

    ReplyDelete
  13. Masha Allah..Great job done...Keep up the good work... :)

    ReplyDelete
  14. Thanks for sharing it

    ReplyDelete
  15. Thanks for sharing it. It has helped me a lot.

    ReplyDelete
  16. when you open with hostname in window's(\\orange) it's not open,but when you open with ip (\\192.168.1.10) the share folder is open.kindly share the solution,it will helpful for others.

    ReplyDelete
    Replies
    1. Good day Shiva,
      Have you configured hostname orange in your hosts file in windows. If not please set it in hosts file and try ping with hostname. If it work \\orange will also work.

      I hope it will fix the problem,
      Regards,
      Nasir Zeeshan

      Delete
    2. 450 pc is there in our setup,already DNS configured in solaris samba . not possible to configure host entry in all 450 servers,any other alternate solution is there???

      Delete
    3. DNS entry is also fine, make sure ping works.

      Delete
  17. From Windows server getting below error while trying to share the drive
    System error 1312 has occurred.

    A specified logon session does not exist. It may already have been terminated.

    ReplyDelete
    Replies
    1. Please check the following link. I hope it will help.

      https://social.technet.microsoft.com/Forums/windowsserver/en-US/4bb8261f-7851-44b5-b3b1-b58067a0bdb0/remoting-net-use-on-dfs-share-error-1312?forum=winserverfiles

      Delete
  18. It may useful to add "host allow" parameter in your article. Thanks

    ReplyDelete
  19. when i use smbpasswd -a user i get this msg
    Failed to add entry for user user

    ReplyDelete