CentOS 7 搭建Samba环境

 

CentOS 7 搭建Samba环境

一、安装Samba

yum install samba

二、关闭selinux和防火墙

# setenforce 0

# sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/’ etc/selinux/config

# systemctl stop firewalld

#systemctl disable firewalld

三、配置Samba配置文件

# cp /etc/samba/smb.conf etc/samba/smb.conf.bak

# vim etc/samba/smb.conf

在最后加入:

[hu]

comment = this is the info //comment是对该共享的描述,可以是任意的。

path = /home/hu //共享的路径

writable = yes

public = no

四、添加hu账号

设置为不允许登入系统,且用户的家目录为/home/hu的hu账号:

# useradd -d /home/hu -s /sbin/nologin hu

五、pdbedit 命令说明

pdbedit命令用于管理samba服务的账户信息数据库,格式为:”pdbedit [选项] 账户”

第一次把用户信息导入到数据库时需要使用-a参数,以后修改用户密码、删除用户等操作就不需要了。

pdbedit -L : 查看samba用户

pdbedit -a -u user: 添加samba用户

pdbedit -r -u user: 修改samba用户信息

pdbedit -x -u user: 删除samba用户

samba 服务数据库的密码也可以用smbpasswd 命令操作

smbapasswd -a user: 添加一个samba用户

smbpasswd -d user: 禁用一个samba用户

smbpasswd -e user: 恢复一个samba用户

smbpasswd -x user: 删除一个samba用户

六、将hu添加为samba用户

pdbedit -a -u hu

七、 启动samba服务

# systemctl start smb

#systemctl enable smb

# systemctl restart smb

# systemctl status smb

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章