码迷,mamicode.com
首页 > 其他好文 > 详细

samba服务的搭建

时间:2017-03-29 14:52:22      阅读:223      评论:0      收藏:0      [点我收藏+]

标签:服务   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 ~]# 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是虚拟机 

技术分享

#登陆

技术分享


技术分享


技术分享

#测试成功



#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 credentails=/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测试成功!

本文出自 “Chauncey” 博客,请务必保留此出处http://cqwujiang.blog.51cto.com/10808946/1911247

samba服务的搭建

标签:服务   samba   

原文地址:http://cqwujiang.blog.51cto.com/10808946/1911247

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!