Você está na página 1de 5

How to Set Up Samba in the OpenSolaris 2009.

06 Release
Samba is a software suite that provides file and print services to Microsoft Windows clients. Samba can be hosted on any number of platforms. This "How To" describes using Samba in the OpenSolaris release. To get Samba up and running is fairly simple, especially in a home environment, where you are sharing data or printers between a system that is running OpenSolaris and a Windows client. You can configure Samba one of two ways:

From the command line By using the Samba Web Administration Tool (SWAT)

This "How To" provides instructions for configuring Samba both ways. For users uncomfortable with editing files, the SWAT configuration is recommended, as it is web-based and displays all of the possible settings, along with a concise help feature.
Before You Begin

To get started, use the Package Manager to install the SUNWsmba package. More details about installing Samba are provided in the task sections that follow. Note To ensure a successful installation, your UNIX and Windows user name and passwords should match. There are methods for mapping user names and for syncing passwords. These methods are not described in this "How To". Also, make sure that all of your printers are installed before starting the configuration, Samba will gather printer information from the /etc/printers.conf file.
How to Configure Samba With SWAT

1. Enable swat. Open a terminal window and assume the root role.
$ su root # svcadm enable swat

2. Check to make sure SWAT is online.


# svcs -a | grep swat

3. Launch your web browser and point to http://localhost:901. 4. Log in to the site as root, with your root password.

Note The SWAT login requires root privileges. In the OpenSolaris release, the root account is a role that conforms to Role Based Access Control (RBAC). If you have not done so already, type the following command to assume the root role before attempting to log in to SWAT.
$ rolemod -K type=normal root

After you log in, you are located in the SWAT home screen.

5. Click the GLOBALS icon at the top of the SWAT home screen. 6. Set the GLOBAL parameters as follows:

workgroup = Set to your home workgroup. You can get this information from your Windows client. The workgroup will probably be something like WORKGROUP or MSHOME. security = User encrypt passwords = Yes

7. After these parameters are set, click "Commit Changes". If you have any questions about these options, click Help. 8. Set the following SHARES parameters:

comment = Home Directory path = /export/home/%u read only = No browsable = Yes available = Yes

Shares can be any file system that is on the system. This "How To" concentrates on home directories. 9. Click "Commit Changes". Note The "%u" in the path statement translates to the UNIX username that the client is using for this connection. If you have usernames that are different, you will need to create a username map and set it in GLOBALS, under Advanced View > Security Options > username map. See Help for more information. 10. Set PRINTER Parameters. If you installed your printers before configuring Samba, select your printer from the drop-down list, then click "Choose Printer". 11. Set the following important parameters:

comment = Postscript Printer path = /var/spool/samba printable = Yes browsable = Yes available = Yes

12. After you have made your selections, click "Commit Changes". 13. In the Server Password Management screen, type your username, password, and re-type your password.

14. Select "Add New User". The screen displays "Added User: <username>". To reduce the number of open ports you have, when you are not using SWAT, disable it.
How to Configure Samba From the Command Line

1. Open a Terminal and assume the root role. 2. Copy the example file to the smb.conf file and open it with an editor.
# cd /etc/sfw # cp smb.conf-example smb.conf # vi smb.conf

3. To make the setting active, remove any settings that begin with ";", as these are disabled. The template includes full comments for each setting. 4. Modify are the following settings:

[global] o workgroup = Change to your WORKGROUP. [homes] o path = Add your path to your home directories ( /export/home/%u ). o browsable = Change to yes to allow the home share to be seen by the browser service.

5. Use the smbpasswd command to add your username.


# smbpasswd -a <username> New SMB password: Re-Type New SMB Password: Added user <username>

You are ready to start Samba.


How To Start Samba

1. Enable the samba and wins services.


# svcadm enable samba # svcadm enable wins

2. Check that the daemons are online: For example:


# svcs -a| grep wins online 16:06:20 svc:/network/wins:default # svcs -a | grep samba online 16:06:20 svc:/network/samba:default

You should now be able to access your home directory and your printers from your Windows client. If you've set browsable = yes in your smb.conf file, you should see the shares in Network Neighborhood. Alternatively, you could map your home directory to always mount at login.
Special Notice for Windows Vista and Windows 7 Users

Microsoft Knowledge Base Article ID 954387 Note For certain versions of Vista and Windows 7, Microsoft changed the default security profile for NTLM authentication, this in effect breaks Samba. To fix this problem, follow these steps: 1. Select Start > Run and type secpol.msc. 2. Navigate to Local Policies > Security Options 3. Right Click "Network Security: LAN Manager authentication level" and select Properties. 4. Select "Local Security Settings". 5. Change the Policy to "Send LM & NTLM - user NTLMV2 session security if negotiated". 6. Click OK and quite the Security Policy Editor. 7. Log out and then back in or reboot your system. You should now be able to access your Samba shares and printers.

Você também pode gostar