Configure the Samba service through command lines

Source: Internet
Author: User
Command line configuration Samba service-Linux Enterprise Application-Linux server application information. The following is a detailed description. Samba uses/etc/samba/smb. conf as its configuration file. If you change the configuration file, the change will not take effect until you restart the Samba daemon using the service smb restart command.
To specify a Windows workgroup and a brief description of it, edit the following lines in the smb. conf file:
Workgroup = WORKGROUPNAME
Server string = BRIEF COMMENT ABOUT SERVER
Replace WORKGROUPNAME with the name of the Windows workgroup to which your machine belongs. Brief comment about server is optional and is used as a Windows COMMENT on the Samba system.
To create a Samba shared directory on your Linux system, add the following lines to the smb. conf file (after modifying the file according to your and your system needs ):
[Sharename]
Comment = Insert a comment here
Path =/home/share/
Valid users = tfox carole
Public = no
Writable = yes
Printable = no
Create mask = 0765
The preceding example allows tfox and carole to read and write the/home/share directory on the Samba server from the Samba client.
-------------
Encrypted password
-------------
In Red Hat Linux 9, the encrypted password is enabled by default because it is safer. If the encrypted password is not used, the plain text password is used and can be intercepted by someone else using the Network Group sniffer. We recommend that you use an encrypted password.

Microsoft SMB uses a plain text password. However, Windows NT 4.0, Windows 98, Windows 2000, Windows ME, and Windows XP with a service package 3 or higher require an encrypted Samba password. Samba must be used between the Red Hat Linux system and the system running the above Windows operating system, you can edit Windows registries to use plain text passwords to configure Samba in your Linux system to use encrypted passwords. If you choose to modify your Registrar, you must do this for all your Windows machines-this is risky and may cause further conflicts. We recommend that you use an encrypted password for higher security.

To configure Samba to use an encrypted password on your Red Hat Linux system, follow these steps:
1. Create a separate password file for Samba. To create a file based on your existing/etc/passwd file, enter the following command at the shell prompt:
Cat/etc/passwd | mksmbpasswd. sh>/etc/samba/smbpasswd
If the system uses NIS, type the following command:
Ypcat passwd | mksmbpasswd. sh>/etc/samba/smbpasswd
The mksmbpasswd. sh script and samba package are installed in your/usr/bin directory together.
2. Change the Samba Password File Permission, so only the root user has the read and write permissions:
Chmod 600/etc/samba/smbpasswd
3. This script will not copy the user password to the new file, and the Samba user account will not be activated until the password is set. For higher security, we recommend that you set your Samba password to be different from your Red Hat Linux Password. To set the password for each Samba user, use the following command (replace username with the username of each user ):
Smbpasswd username
4. The encrypted password must be enabled in the Samba configuration file. In the smb. conf file, make sure the following lines are not commented out:
Encrypt passwords = yes
Smb passwd file =/etc/samba/smbpasswd
5. Enter service smb restart in the shell prompt to confirm that the smb service is started.
6. If you want to enable the smb service automatically, use ntsysv, chkconfig, or service configuration tool to enable it during runtime.
-----------------------------------------------------------
Tips
Read/usr/share/doc/samba-/docs/htmldocs/ENCRYPTION.html to learn more about the encrypted password. (Replace it with the Samba version number you have installed ).
-----------------------------------------------------------
When the passwd command is used, the pam_smbpass PAM module can be used to synchronize users' Samba passwords and their system passwords. If the passwd command is enabled, the password used to log on to the Red Hat Linux System and the password required to connect to Samba sharing will be changed.

To enable this function, add the following lines to the startup pam_cracklib.so of/etc/pam. d/system-auth:
Password required/lib/security/pam_smbpass.so nullok use_authtok try_first_pass
--------------------
Start and Stop a server
--------------------
The smb service must be run on a server that shares a directory through Samba.

Run the following command to view the status of the Samba daemon:

/Sbin/service smb status


Run the following command to start the daemon:

/Sbin/service smb start


Run the following command to stop the daemon:

/Sbin/service smb stop


To start the smb service during boot, run the following command:

/Sbin/chkconfig -- level 345 smb on
You can also use chkconfig, ntsysv, or service configuration tool to configure the service to be started at boot.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.