系统环境:
[[email protected] ~]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
[[email protected] ~]# uname -r
3.10.0-327.el7.x86_64
[[email protected] ~]# ip addr show enp0s8 | awk ‘NR==3{print $2}‘
192.168.235.36/24
#关闭防火墙和selinux
#安装samba
[[email protected] ~]# yum install -y samba
[[email protected] ~]# mkdir /share
[[email protected] ~]# echo "hrllo" > /share/test.txt
[[email protected] ~]# chmod -R 777 /share
[[email protected] ~]# yum install -y cifs-utils
[[email protected] ~]# useradd -s /sbin/nologin -M smb
[[email protected] ~]# 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
[[email protected] ~]# systemctl start smb
#windows测试
#新开一太window是虚拟机
#登陆
#测试成功
#Linux 测试
[[email protected] ~]# mkdir /smb #创建挂载目录
[[email protected] ~]# vim /etc/samba/auth.smb #创建认证文件
[[email protected] ~]# cat /etc/samba/auth.smb
username=smb
password=123456
domain=SAMBA
[[email protected] ~]# echo "//192.168.235.36/test /smb/ cifs credentails=/etc/samba/auth.smb 0 0" >> /etc/fstab
[[email protected] ~]# mount -a
[[email protected] ~]# cd /smb/
[[email protected] smb]# ls
test.txt
[[email protected] 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
[[email protected] smb]# echo "hello" >ss.txt
[[email protected] 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
[[email protected] smb]# ls /share/
ss.txt test.txt
[[email protected] smb]#
#LInux测试成功!