Use Samba file sharing service

1. Installation Samba server installation package on a virtual machine (downloading before checking whether the client is able to ping the server) (Main service port number for the Samba 137,138,139,445)

(Right-click the desktop, open whether the terminal, and yum can ping test, the following command line is the IP address of my yum)

[root@huming_hbza ~]#ping 192.168.26.10

:( then enter the command line to install Samba service installation package)

[root@huming_hbza ~]#yum install samba

FIG execution results are as follows:

 

The installation was successful as shown below:

2. modify the configuration file

Here to remind the reader that: before modifying the configuration file, we can develop good habits will be backed up the original configuration file

Specific execute the following command line:

[root@huming_hbza ~]#cp /etc/samba/smb.conf /etc/samba/smb.conf.bak

Performed as shown below:

Let us enter into the Samba file to modify the Samba configuration file, this time to remember that the file is smb.conf Samba configuration file

Command Line:

[root@huming_hbza ~]#cd /etc/samba
[root@huming_hbza ~]#vim smb.conf

After the knockout round will pop up as shown in the following interface:

[global]
    workgroup = workgroup                   //工作组名称
    server string = Samba Server %v         //服务器介绍信息,参数%v为显示SMB版本号
    security = user                                //安全验证的方式
    map to guest = bad user                  
    dns proxy = no
[anonymous]                                           //共享名称为anonymous
    comment = This is a dirctory of anonymous.       //警告用户的内容
    path = /samba/anonymous                               //共享文件夹所在的位置
    browseable = yes                                             
    writeable = yes                                   //允许写入操作      
    guest ok = yes                                   //是否所有人可见,等同于“public参数”
    read only = no

将上图中的配置文件改成如下图所示:(注:anonymous部分是需要自己添加进去的,而global部分是需要在原来的基础上进行更改)

保存退出

 

创建共享目录anonymous,进入到该目录下并在anonymous文件中创建一个1.txt文件,并且开启smb和nmb服务以及将这两个服务设置为开机自启动 ,具体命令行操作如下:

[root@huming_hbza ~]#mkdir -p /samba/anonymous
[root@huming_hbza ~]#cd /samba/anonymous
[root@huming_hbza ~]#echo "deyaugyua123456789" > 1.txt    //在anonymous文件中创建一个1.txt
[root@huming_hbza ~]#systemctl start smb.service
[root@huming_hbza ~]#systenctl start nmb.service
[root@huming_hbza ~]#systemctl enable smb.service //设置为开机自启动
[root@huming_hbza ~]#systemctl enable nmb.service //设置为开机自启动

操作如下图示:

 

 接下来可以在自己的主机上打开我的电脑输入:

\\192.168.26.100(自己建立的Samba服务的客户机的地址 )

 

 注:自己的主机一定要和客户机ping通否则会出现如下图提示:

 

 然后输入CentOS系统的账户和密码就是登陆凭证,进去之后就是如下界面:(在CentOS系统中创立的文件)

 

 

然后点击打开右击之后发现是可以复制的,即也可以拖拽复制到自己的主机上如下图显示,但是这里提醒一下读者,因为在配置smb.conf文件的权限时候没有加上写权限是关闭的,即在自己主机上是不可以保存以及上传文件的,只可以下载文件,如果有需要可以再去更改一下配置文件,

 

 

 

 

 

 

如果更改文件保存的话会出现如下图的提示:

 

 

Samba服务的操作就介绍到这里了,多数我们使用是为了从服务器下载文件比较方便才进行的,感兴趣的小伙伴赶紧跟着教程去试试吧

 

Guess you like

Origin www.cnblogs.com/Ghost-m/p/11768193.html