linux文件服务——samba

linux文件服务——samba

1、samba是什么:Samba 是一套开源软件,主要用于实现非 Microsoft Windows 操作系统(如 Linux 和 Unix)与基于 Windows 的客户端之间的文件共享和打印服务。Samba 实现了 Server Message Block (SMB) 协议,该协议也被称为 Common Internet File System (CIFS),是 Windows 系统之间以及 Windows 系统与其他系统之间进行文件和打印共享的标准协议。

主要功能文件和打印服务:Samba 允许在 Linux 或 Unix 服务器上设置共享文件夹和打印机,使 Windows 客户端能够像访问本地资源一样访问这些资源。身份验证和安全:Samba 支持多种身份验证机制,包括本地用户数据库、Windows 域或 Active Directory。这意味着用户可以从 Windows 客户端使用他们的 Windows 凭证登录到 Samba 服务器。域成员资格:Samba 可以作为独立服务器运行,也可以加入到现有的 Windows 域中作为成员服务器。Active Directory 域控制器:较新的 Samba 版本还支持充当 Active Directory 域控制器,可以处理复杂的域环境中的各种任务,如用户和组管理、策略应用等。使用场景在混合环境中,Linux 或 Unix 服务器可以与 Windows 工作站和服务器无缝集成。提供对 Linux 或 Unix 服务器上的文件和打印机的网络访问,而无需安装额外的客户端软件。为组织内的不同操作系统提供统一的身份验证和授权机制。2、samba怎么用:2.1、使用yum安装samba

代码语言:shell复制[root@localhost ~]# yum install -y samba2.2、修改配置文件

Samba 的主要配置文件是 /etc/samba/smb.conf

代码语言:shell复制[root@localhost xiaoge]# cat /etc/samba/smb.conf

# See smb.conf.example for a more detailed config file or

# read the smb.conf manpage.

# Run 'testparm' to verify the config is correct after

# you modified it.

[global]

workgroup = SAMBA

security = user

passdb backend = tdbsam

printing = cups

printcap name = cups

load printers = yes

cups options = raw

[homes]

comment = Home Directories

valid users = %S, %D%w%S

browseable = No

read only = No

inherit acls = Yes

[printers]

comment = All Printers

path = /var/tmp

printable = Yes

create mask = 0600

browseable = No

[print$]

comment = Printer Drivers

path = /var/lib/samba/drivers

write list = @printadmin root

force group = @printadmin

create mask = 0664

directory mask = 0775

#根据自身需要添加下列信息

[xiaoge]

comment = This is test configure

path = /home/xiaoge

public = no

writable = yes

guest ok =yes3、在windows电脑上进行远程测试

3、额外补充:示例配置Global Settings:定义全局设置,如工作组名称、服务器名称、安全模式等。Shared Folders:定义共享文件夹的路径、权限等。User Authentication:为 Samba 用户设置密码。启动和服务管理启动服务:使用 systemctl start smbd 和 systemctl start nmbd。服务状态:使用 systemctl status smbd 查看服务状态。自动启动:使用 systemctl enable smbd 和 systemctl enable nmbd 使服务随系统启动。pdbedit命令pdbedit是samba的用户管理命令

语法

代码语言:shell复制pdbedit -a username:新建Samba账户。

pdbedit -r username:修改Samba账户。

pdbedit -x username:删除Samba账户。

pdbedit -u, --user=USER use username

pdbedit -L:列出Samba用户列表,读取passdb.tdb数据库文件。

pdbedit -Lv:列出Samba用户列表详细信息。

pdbedit -c “[D]” -u username:暂停该Samba用户账号。

pdbedit -c “[]” -u username:恢复该Samba用户账号。

相关文章

国风·豳风
365出款成功未到

国风·豳风

⌛ 12-17 👁️‍🗨️ 1012
Android 系统连接WIFI显示网络连接受限分析处理
det365手机版

Android 系统连接WIFI显示网络连接受限分析处理

⌛ 10-27 👁️‍🗨️ 1423