欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  科技

LINUX开启SAMBA服务

程序员文章站 2022-03-20 21:26:28
samba,用于网络文件共享,类似于nfs,samba多用于win和linux之间linux之间多用nfsc/s架构smb协议samba主要是两个服务,核心启动服务SMB,监听139TCP端口,NMB服务类似DSN功能,如果不启,只能以ip来访问,监听137 138UDP端口使用yum -y ins... ......

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]#

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