Samba服务学习

Samba服务
功能:文件和打印机共享
身份验证和权限设置
名称解析
浏览服务

端口号:445
Samba部署
1.修改主机名:

[root@localhost ~]# hostnamectl set-hostname samba
[root@localhost ~]# bash
[root@samba ~]#

2.安装samba

[root@samba ~]# yum install -y samba

3.修改配置文件

vi /etc/samba/smb.conf
    load printers = no
    cups options = raw

; printcap name = /dev/null
# obtain a list of printers automatically on UNIX System V systems:
; printcap name = lpstat
; printing = bsd
新增 disable spoolss=yes
在最后添加
[share]
path =/opt/share共享的目录,没有的话要自己创建
browseable=yes操作权限
public=yes访问权限
writable=yes对文件的操作权限
4.创建目录并赋予权限

[root@samba ~]# mkdir /opt/share
[root@samba ~]# chmod 777 /opt/share/

此时777权限属于share,opt权限依旧是755
5.启动Samba服务

[root@samba ~]# systemctl start smb
[root@samba ~]# systemctl start nmb

6.查看端口(端口号为445)

[root@samba ~]# netstat -ntpl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:139             0.0.0.0:*               LISTEN      3112/smbd           
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      2387/rpcbind        
tcp        0      0 0.0.0.0:20048           0.0.0.0:*               LISTEN      2398/rpc.mountd     
tcp        0      0 0.0.0.0:44081           0.0.0.0:*               LISTEN      2396/rpc.statd      
tcp        0      0 0.0.0.0:52596           0.0.0.0:*               LISTEN      -                   
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1139/sshd           
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1528/master         
tcp        0      0 0.0.0.0:445             0.0.0.0:*               LISTEN      3112/smbd           
tcp        0      0 0.0.0.0:2049            0.0.0.0:*               LISTEN      -                   
tcp6       0      0 :::139                  :::*                    LISTEN      3112/smbd           
tcp6       0      0 :::111                  :::*                    LISTEN      2387/rpcbind        
tcp6       0      0 :::20048                :::*                    LISTEN      2398/rpc.mountd     
tcp6       0      0 :::40722                :::*                    LISTEN      2396/rpc.statd      
tcp6       0      0 :::21                   :::*                    LISTEN      2468/vsftpd         
tcp6       0      0 :::22                   :::*                    LISTEN      1139/sshd           
tcp6       0      0 :::44888                :::*                    LISTEN      -                   
tcp6       0      0 ::1:25                  :::*                    LISTEN      1528/master         
tcp6       0      0 :::445                  :::*                    LISTEN      3112/smbd           
tcp6       0      0 :::2049                 :::*                    LISTEN      -                 

7.创建Samba用户(用户必须是已经存在的,也可以使用root用户)

[root@samba ~]# useradd test
[root@samba ~]# smbpasswd -a test
New SMB password:
Retype new SMB password:
Added user test.

8.重启Samba服务

[root@samba ~]# service smb restart
Redirecting to /bin/systemctl restart  smb.service

也可使用systemctl restart samba
9.关闭防火墙和规则

[root@samba ~]# systemctl stop firewalld
[root@samba ~]# systemctl disable firewalld
[root@samba ~]# setenforce 0
[root@samba ~]# getenforce
Permissive

10.使用Samba服务
在这里插入图片描述

弹出界面输入用户名和密码
在这里插入图片描述
登录成功后
在这里插入图片描述

目录test 是在home下

[root@samba ~]# cd /home/test
[root@samba test]# touch 1 2 3

```也可使用root用户

```bash
[root@samba ~]# smbpasswd -a root
New SMB password:
Retype new SMB password:
Added user root.

11.删除记录在cmd下输入net use * /del /y
重新访问
在这里插入图片描述
重新输入用户名和密码
可以看到root目录
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值