samba服务的搭建

简介:

系统环境:

[root@RHCE ~]# cat /etc/redhat-release 

CentOS Linux release 7.2.1511 (Core) 

[root@RHCE ~]# uname -r

3.10.0-327.el7.x86_64

[root@RHCE ~]# ip addr show enp0s8 | awk 'NR==3{print $2}'

192.168.235.36/24

#关闭防火墙和selinux

#安装samba

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

[root@RHCE ~]# mkdir /share

[root@RHCE ~]# echo "hrllo" > /share/test.txt

[root@RHCE ~]# chmod -R 777 /share

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

[root@RHCE ~]# cat /etc/samba/smb.conf  | grep -v "#" | grep -v "^$" | grep -v "^;"

[global]

workgroup = MYGROUP

server string = Samba Server Version %v

log file = /var/log/samba/log.%m

max log size = 50

security = user

passdb backend = tdbsam

load printers = yes

cups options = raw

[homes]

comment = Home Directories

browseable = no

writable = yes

[printers]

comment = All Printers

path = /var/spool/samba

browseable = no

guest ok = no

writable = no

printable = yes

[test]

comment = test share dir

path = /share

browseable = yes

guest ok = yes

writable = yes


[root@RHCE ~]# yum install -y cifs-utils

[root@RHCE ~]# useradd -s /sbin/nologin -M smb

[root@RHCE ~]# pdbedit -a -u smb         #输入密码

new password:

retype new password:

Unix username:        smb

NT username:          

Account Flags:        [U          ]

User SID:             S-1-5-21-3421928618-115065893-1468720116-1000

Primary Group SID:    S-1-5-21-3421928618-115065893-1468720116-513

Full Name:            

Home Directory:       \\rhce\smb

HomeDir Drive:        

Logon Script:         

Profile Path:         \\rhce\smb\profile

Domain:               RHCE

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:    Tue, 28 Mar 2017 21:36:05 CST

Password can change:  Tue, 28 Mar 2017 21:36:05 CST

Password must change: never

Last bad password   : 0

Bad password count  : 0

Logon hours         : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF


[root@RHCE ~]# systemctl start smb


#windows测试

#新开一太window是虚拟机 

wKioL1jaZ-aB2AHYAAAhO2jPhDE318.png

#登陆

wKioL1jaaXCzgjf8AAA8Xd39zsA535.png


wKiom1jaabCicOz-AABP4RIMwDs135.png


wKioL1jaafeC3py8AABVW6TLJ-w802.png

#测试成功



#Linux 测试

[root@RHCE ~]# mkdir /smb          #创建挂载目录

[root@RHCE ~]# vim /etc/samba/auth.smb   #创建认证文件

[root@RHCE ~]# cat /etc/samba/auth.smb

username=smb

password=123456

domain=SAMBA

[root@RHCE ~]# echo "//192.168.235.36/test     /smb/ cifs credentials=/etc/samba/auth.smb 0 0" >> /etc/fstab 

[root@RHCE ~]# mount -a

[root@RHCE ~]# cd /smb/

[root@RHCE smb]# ls

test.txt

[root@RHCE smb]# df -h

Filesystem               Size  Used Avail Use% Mounted on

/dev/mapper/centos-root   17G  1.1G   16G   7% /

devtmpfs                 487M     0  487M   0% /dev

tmpfs                    497M     0  497M   0% /dev/shm

tmpfs                    497M  6.6M  490M   2% /run

tmpfs                    497M     0  497M   0% /sys/fs/cgroup

/dev/sr0                 7.3G  7.3G     0 100% /mnt/cdrom

/dev/sda1                697M  131M  567M  19% /boot

tmpfs                    100M     0  100M   0% /run/user/0

//192.168.235.36/test     17G  1.1G   16G   7% /smb


[root@RHCE smb]# echo "hello" >ss.txt

[root@RHCE smb]# ll

total 8

-rw-r--r--. 1 smb  smb  6 Mar 28 22:00 ss.txt

-rwxrwxrwx. 1 root root 6 Mar 27 20:42 test.txt

[root@RHCE smb]# ls /share/

ss.txt  test.txt

[root@RHCE smb]# 

#LInux测试成功!










本文转自 chaunceyjiang  51CTO博客,原文链接:http://blog.51cto.com/cqwujiang/1911247,如需转载请自行联系原作者
目录
相关文章
|
9月前
|
Ubuntu Linux 数据安全/隐私保护
搭建Samba服务器
搭建Samba服务器
206 0
|
11月前
|
网络协议 Unix Linux
Samba服务的安装与配置
Samba服务的安装与配置
2409 0
|
运维 网络安全 数据安全/隐私保护
部署Samba
部署Samba
阿里云搭建 samba服务器
前言:我搭建samba服务器,只是想通过window系统的映射网络驱动器,将阿里云服务器的开发目录挂在到window系统上,这样就可以在window系统上编写代码,然后通过Xshell终端上编译运行了,一切只是为了方便! 1.
|
安全 开发工具
SAMBA 服务器安装与配置
#!/bin/bash #SAMBA  window co-connect linux #SAMBA  NETBIOS #SAMBA nmbd:137 138  smbd:139 445 #samba samba-client samba-common /etc/samba/smb.
890 0
|
测试技术 Linux 数据库
|
Linux 数据安全/隐私保护
|
关系型数据库 数据安全/隐私保护
|
测试技术 Linux Windows