LINUX开启SAMBA服务

samba,用于网络文件共享,类似于nfs,

samba多用于win和linux之间

linux之间多用nfs

c/s架构

smb协议

samba主要是两个服务,核心启动服务SMB,监听139TCP端口,NMB服务类似DSN功能,如果不启,只能以ip来访问,监听137 138UDP端口

使用

yum -y install samba

然后防火墙

systemctl stop firewalld.service

然后selinux

[root@localhost ~]# sestatus
SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode:                   enforcing
Mode from config file:          enforcing
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Max kernel policy version:      31
[root@localhost ~]# setenforce 0
[root@localhost ~]# sestatus
SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode:                   permissive
Mode from config file:          enforcing
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Max kernel policy version:      31
[root@localhost ~]#

启动下smb

[root@localhost ~]# service smb status
Redirecting to /bin/systemctl status smb.service
● smb.service - Samba SMB Daemon
   Loaded: loaded (/usr/lib/systemd/system/smb.service; disabled; vendor preset: disabled)
   Active: inactive (dead)
     Docs: man:smbd(8)
           man:samba(7)
           man:smb.conf(5)
[root@localhost ~]# systemctl start smb
[root@localhost ~]# service smb status 
Redirecting to /bin/systemctl status smb.service
● smb.service - Samba SMB Daemon
   Loaded: loaded (/usr/lib/systemd/system/smb.service; disabled; vendor preset: disabled)
   Active: active (running) since Mon 2019-04-01 15:34:00 CST; 5s ago
     Docs: man:smbd(8)
           man:samba(7)
           man:smb.conf(5)
 Main PID: 3137 (smbd)
   Status: "smbd: ready to serve connections..."
    Tasks: 4
   CGroup: /system.slice/smb.service
           ├─3137 /usr/sbin/smbd --foreground --no-process-group
           ├─3140 /usr/sbin/smbd --foreground --no-process-group
           ├─3141 /usr/sbin/smbd --foreground --no-process-group
           └─3142 /usr/sbin/smbd --foreground --no-process-group

Apr 01 15:34:00 localhost.localdomain systemd[1]: Starting Samba SMB Daemon...
Apr 01 15:34:00 localhost.localdomain smbd[3137]: [2019/04/01 15:34:00.812166,  0] ../lib/util/become_daemon.c:138(daemon_ready)
Apr 01 15:34:00 localhost.localdomain smbd[3137]:   daemon_ready: STATUS=daemon 'smbd' finished starting up and ready to serve connections
Apr 01 15:34:00 localhost.localdomain systemd[1]: Started Samba SMB Daemon.
[root@localhost ~]#

配置文件/etc/samba/smb.conf,就默认配置吧 然后添加用户

[root@localhost samba]# pdbedit -a oracle
new password:
retype new password:
Unix username:        oracle
NT username:          
Account Flags:        [U          ]
User SID:             S-1-5-21-3894974451-2409427747-3149240937-1000
Primary Group SID:    S-1-5-21-3894974451-2409427747-3149240937-513
Full Name:            
Home Directory:       \\localhost\oracle
HomeDir Drive:        
Logon Script:         
Profile Path:         \\localhost\oracle\profile
Domain:               LOCALHOST
Account desc:         
Workstations:         
Munged dial:          
Logon time:           0
Logoff time:          Wed, 06 Feb 2036 23:06:39 CST
Kickoff time:         Wed, 06 Feb 2036 23:06:39 CST
Password last set:    Mon, 01 Apr 2019 15:49:50 CST
Password can change:  Mon, 01 Apr 2019 15:49:50 CST
Password must change: never
Last bad password   : 0
Bad password count  : 0
Logon hours         : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
[root@localhost samba]# pdbedit -L
oracle:54321:
[root@localhost samba]#

image

win中入网账号密码就可以了

posted @ 2019-08-31 13:04  九命猫幺  阅读(15154)  评论(0编辑  收藏  举报