Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to configure samba for Linux server

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Linux server how to configure samba, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.

Configure samba to log in with a user name and password

1. When the secure in the samba configuration file is set to user, the correct user name and password are required to log in.

Root@localhost /] # gedit / etc/samba/smb.conf

#-Standalone Server Options-

# Scurity can be set to user, share (deprecated) or server (deprecated)

# Backend to store user information in. New installations should

# use either tdbsam or ldapsam. Smbpasswd is available for backwards

# compatibility. Tdbsam requires no further configuration

Security = user / / this is the default value and requires a username and password

Passdb backend = tdbsam

2. Manage accounts and passwords

Samba uses tdbsam database management mechanism by default to manage username and password uniformly. The command used is pdbedit, which is as follows

Command

Description

Pdbedit-L

List samba users

Pdbedit-Lv

List samba user details

Pdbedit-Lw

List users in smbpasswd format

Pdbedit-a wj

Increase user wj

Pdbedit-x wj

Delete user wj

Pdbedit-c "[D]"-u wj

Pause user wj

Pdbedit-c "[]"-u wj

Reply to user wj

3. To add a user, you must ensure that this user exists in your Linux system

[root@localhost wj] # pdbedit-a david / / add user david

New password:

Retype new password:

Unix username: david

NT username:

Account Flags: [U]

User SID: Smurl 1-5-21-1098217942-694112815-2930643030-1000

Primary Group SID: Smurl 1-5-21-1098217942-694112815-2930643030-513

Full Name: david

Home Directory:\\ localhost\ david

HomeDir Drive:

Logon Script:

Profile Path:\\ localhost\ david\ profile

Domain: LOCALHOST

Account desc:

Workstations:

Munged dial:

Logon time: 0

Logoff time: never

Kickoff time: never

Password last set: March, 15th August 2018 10:15:21 CST

Password can change: March, 15th August 2018 10:15:21 CST

Password must change: never

Last bad password: 0

Bad password count: 0

Logon hours: FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF

[root@localhost wj] # pdbedit-L / / check whether the addition is successful

David:500:david

4. Restart the smb service

[root@localhost wj] # gedit / etc/sysconfig/iptables

-An INPUT-m state-- state NEW-m tcp-p tcp-- dport 137-j ACCEPT

-An INPUT-m state-- state NEW-m tcp-p tcp-- dport 138j ACCEPT

-An INPUT-m state-- state NEW-m tcp-p tcp-- dport 139-j ACCEPT

-An INPUT-m state-- state NEW-m tcp-p tcp-- dport 445-j ACCEPT

[root@localhost wj] # service iptables restart

Iptables: set chain to policy ACCEPT:filter nat [OK]

Iptables: clear firewall rules: [OK]

Iptables: uninstalling module: [OK]

Iptables: apply firewall rules: [OK]

Iptables: load additional modules: nf_conntrack_ftp [OK]

5. Start the smb service

[root@localhost wj] # service smb restart

Shut down the SMB service: [OK]

Start the SMB service: [OK]

[root@localhost wj] #

6. From the windows test, press the shortcut key "window+r" and enter the command "smb:\\ 192.168.0.113" in the pop-up window, asking for a user name and password, and anonymous users cannot log in.

After logging in, users can only view their own home directory and cannot select other directories

A Linux learning platform has been made, and a prototype has come out at present, which you can refer to and use.

Link: https://pan.baidu.com/s/1GOLVU2CbpBNGtunztVpaCQ password: n7bk

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report