0
点赞
收藏
分享

微信扫一扫

Samba配置

服务器端:CentOS 7.9  IP:192.168.133.161

客户端:Windows 11

实验目标:安装Samba,实现Linux与Windows之间的文件共享.

安装Samba

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

[root@hisdb2 ~]# rpm -qa samba

samba-4.10.16-18.el7_9.x86_64

创建系统用户

[root@hisdb2 ~]# useradd leo

[root@hisdb2 ~]# passwd leo

Changing password for user leo.

New password:

BAD PASSWORD: The password is shorter than 8 characters

Retype new password:

passwd: all authentication tokens updated successfully.

将用户leo添加到smbpasswd

[root@hisdb2 ~]# smbpasswd -a leo

New SMB password:

Retype new SMB password:

Added user leo.

启动Samba服务

[root@hisdb2 ~]# systemctl start smb

[root@hisdb2 ~]# systemctl status smb

● smb.service - Samba SMB Daemon

   Loaded: loaded (/usr/lib/systemd/system/smb.service; disabled; vendor preset: disabled)

   Active: active (running) since Fri 2022-05-20 22:23:10 CST; 23s ago

     Docs: man:smbd(8)

           man:samba(7)

           man:smb.conf(5)

 Main PID: 16475 (smbd)

   Status: "smbd: ready to serve connections..."

    Tasks: 4

   CGroup: /system.slice/smb.service

           ├─16475 /usr/sbin/smbd --foreground --no-process-group

           ├─16481 /usr/sbin/smbd --foreground --no-process-group

           ├─16482 /usr/sbin/smbd --foreground --no-process-group

           └─16483 /usr/sbin/smbd --foreground --no-process-group

 

May 20 22:23:10 hisdb2 systemd[1]: Starting Samba SMB Daemon...

May 20 22:23:10 hisdb2 smbd[16475]: [2022/05/20 22:23:10.758641,  0] ../../lib/util/become_daemon.c:136(daemon_ready)

May 20 22:23:10 hisdb2 smbd[16475]:   daemon_ready: daemon 'smbd' finished starting up and ready to serve connections

May 20 22:23:10 hisdb2 systemd[1]: Started Samba SMB Daemon. 

samba服务启动后,windows连接linux

Samba配置_linux

输入用户leo和密码,如下弹出的对话框为Linux与Windows之间的共享文件夹.

Samba配置_linux_02

服务端执行

[root@hisdb2 ~]# cd /home/leo

[root@hisdb2 leo]# ll

total 0

[root@hisdb2 leo]# touch 11

[root@hisdb2 leo]# ll

total 0

-rw-r--r-- 1 root root 0 May 20 22:25 11

Samba配置_linux_03

如上,windows连接到linux成功访问共享文件夹.

举报

相关推荐

0 条评论