Linux系统与服务构建(二)

# Samba服务的使用

1.安装Samba

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

2.配置Samba服务

修改/etc/samba/smb.conf
修改里面[global]的内容

        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

[share]
        path=/opt/share
        browseable = yes
        public = yes
        writeable = yes

path:这个目录是将要共享的目录,如果没有,需要创建
browseable:参数是操作权限
public:参数是访问权限
writable:参数是对文件操作权限
创建文件并赋予权限

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

启动samba服务

[root@samba ~]# systemctl start smb
[root@samba ~]# systemctl start nmb
[root@samba ~]# netstat -nltp
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      8876/smbd           
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1291/sshd           
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1387/master         
tcp        0      0 0.0.0.0:445             0.0.0.0:*               LISTEN      8876/smbd           
tcp6       0      0 :::139                  :::*                    LISTEN      8876/smbd           
tcp6       0      0 :::22                   :::*                    LISTEN      1291/sshd           
tcp6       0      0 ::1:25                  :::*                    LISTEN      1387/master         
tcp6       0      0 :::445                  :::*                    LISTEN      8876/smbd     

创建用户

[root@samba ~]# smbpasswd -a root
New SMB password:
Retype new SMB password:
Added user root.
[root@samba ~]# service smb restart
Redirecting to /bin/systemctl restart  smb.service
posted @ 2020-07-24 15:36  Dankon  阅读(133)  评论(0)    收藏  举报