Command line configuration Samba service

xiaoxiao2021-03-06  46

Samba uses /etc/samba/smb.conf as its profile. If you change this configuration file, this change until you use the service SMB RESTART command to restart the Samba daemon after it takes effect. To specify a Windows Working Group and a short description of it, edit the following lines in the smb.conf file:

Workgroup = Workgroupname

Server string = Brief Comment Server

Change WorkGroupName to the Windows Working Group name to your machine. BRIEFCOMMENT ABOUT Server is optional, which is used as a Windows annotation for the Samba system.

To create a Samba shared directory on your Linux system, add the following lines in the SMB.conf file (after you need to modify the file according to your system):

[ShareName]

Comment = INSERT A Comment Here

Path = / home / share /

Valid users = tfox carole

Public = no

Writable = yes

Printable = NO

Create Mask = 0765

The above example allows the user TFOX and CAROLE to read the directory / home / share on the Samba server from the Samba client.

Encryption password

In Red Hat Linux 9, the encryption password is enabled by default because it is safer. If the encryption password is not used, the plain text password will be used, which can be intercepted by someone using the network packet sniffer. It is recommended that you use the encrypted password.

The Microsoft SMB protocol initially uses a plain text password. However, Windows NT 4.0, Windows 98, Windows 2000, Windows ME, and Windows XP require encrypted Samba password with service pack 3 or higher. To use Samba between the RedHatlinux system and above the Windows operating system, you can edit the Windows registrar to use the plain text password to configure your Linux system Samba to use the encryption password. If you choose to modify your registrar, you must do this for your entire Windows machine - this is very risky, it is possible to lead to further conflicts. For higher security, it is recommended that you use the encrypted password.

To configure Samba to use encryption passwords on your RedHatlinux system, follow these steps:

1. Create a separate password file for Samba. To create according to your existing / etc / passwd file, type the following command under the Shell Tip:

CAT / etc / passwd | mksmbpasswd.sh> / etc / samba / smbpasswd

If the system uses NIS, type the following command:

Ypcat passwd | mksmbpasswd.sh> / etc / samba / smbpasswd

MKSMBPasswd.sh scripts and Samba packages are installed together on your / usr / bin directory.

2. Change the permission license for the Samba password file, so only root users have read and write permissions:

CHMOD 600 / etc / Samba / SMBPasswd

3. This script does not copy the user password to a new file, and the Samba user account will not be activated until the password is set. For higher security, it is recommended that you set the user's Samba password to passwords that are different from the user's Red Hat Linux password. To set the password for each Samba user, use the following command (replace UserName to each user username):

SMBPASSWD UserName4. Encryption Password must be enabled in the Samba configuration file. In the SMB.conf file, please make sure the following line is not commented:

Encrypt passwords = yes

SMB Passwd File = / etc / samba / smbpasswd

5. Type Service SMB Restart to determine the SMB service at the SHEL prompt.

6. If you want the SMB service to start automatically, use NTSysv, Chkconfig, or Service Configuration Tool to enable it on the runtime.

Trick

Read /usr/share/doc/samba-/docs/htmldocs/encryption.html to learn more about encryption passwords. (Replace your installed Samba version number).

When the Passwd command is used, the PAM_SMBPASS PAM module can be used to synchronize the user's Samba password and their system password. If the user enabled the passwd command, he used the password to log in to the RedHatlinux system and the password he must provide for the Samba sharing must be changed.

To start this feature, add the following to /etc/pam.d/system-auth started under_cracklib.so: Password Required /LIB/Security/pam_smbpass.so nullok use_authtok try_first_pass

Start and stop server

You must run the SMB service on the server shared by the Samba shared directory.

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

/ sbin / service smb status

Use the following command to start the daemon:

/ SBIN / Service SMB Start

Use the following command to stop the daemon:

/ SBIN / Service SMB Stop

To start an SMB service while boot, use the following command:

/ sbin / chkconfig --level 345 SMB on

You can also use the ChkConfig, NTSYSV, or Services Configuration Tool to configure the service you want to boot during boot.

转载请注明原文地址:https://www.9cbs.com/read-60153.html

New Post(0)