Linux Samba 快速创建
生成Samba服务1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23[root@hadoop10 ~]# yum install libsmbclient
[root@hadoop10 ~]# yum install samba
[root@hadoop10 ~]# systemctl restart smb
[root@hadoop10 ~]# netstat -tnlp| grep smbd
tcp 0 0 0.0.0.0:445 0.0.0.0:* LISTEN 23849/smbd
tcp 0 0 0.0.0.0:139 0.0.0.0:* LISTEN 23849/smbd
tcp6 0 0 :::445 :::* LISTEN 23849/smbd
tcp6 0 0 :::139 :::* LISTEN 23849/smbd
[root@hadoop10 ~]#
创建用户
[root@hadoop10 ~]# pdbedit -a root # aduser
密码:free
增加Samba目录分享
[root@hadoop10 ~]# vim /etc/samba/smb.conf
[data_moloch_raw]
path = /data/moloch/raw
write list = root
create mask = 0664
directory mask = 077
[root@hadoop10 ~]# systemctl restart smb #restart
[root@hadoop10 ~]# systemctl enable smb #autostart
节点1挂载:1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17[d:\~]$ ssh root@192.168.109.24
[root@localhost ~]# mkdir -p /data/moloch/raw
[root@localhost ~]# mount -t cifs -o username=root,password='free' //192.168.20.230/data_moloch_raw /data/moloch/raw
[root@localhost ~]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/centos-root xfs 50G 3.1G 47G 7% /
devtmpfs devtmpfs 43G 0 43G 0% /dev
tmpfs tmpfs 63G 0 63G 0% /dev/shm
tmpfs tmpfs 63G 1.9G 61G 3% /run
tmpfs tmpfs 63G 0 63G 0% /sys/fs/cgroup
tmpfs tmpfs 30G 106M 30G 1% /tmp/tbls
/dev/sda2 xfs 1014M 137M 878M 14% /boot
/dev/sda1 vfat 200M 9.8M 191M 5% /boot/efi
/dev/mapper/centos-home xfs 184G 33M 184G 1% /home
tmpfs tmpfs 13G 0 13G 0% /run/user/0
//192.168.20.230/data_moloch_raw cifs 7.0T 685G 6.4T 10% /data/moloch/raw
[root@localhost ~]#
节点2挂载:1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17[d:\~]$ ssh root@192.168.109.23
[root@localhost ~]# mkdir -p /data/moloch/raw
[root@localhost ~]# mount -t cifs -o username=root,password='free' //192.168.20.230/data_moloch_raw /data/moloch/raw
[root@localhost ~]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/centos-root xfs 50G 3.1G 47G 7% /
devtmpfs devtmpfs 43G 0 43G 0% /dev
tmpfs tmpfs 63G 0 63G 0% /dev/shm
tmpfs tmpfs 63G 1.9G 61G 3% /run
tmpfs tmpfs 63G 0 63G 0% /sys/fs/cgroup
tmpfs tmpfs 30G 106M 30G 1% /tmp/tbls
/dev/sda2 xfs 1014M 137M 878M 14% /boot
/dev/sda1 vfat 200M 9.8M 191M 5% /boot/efi
/dev/mapper/centos-home xfs 184G 33M 184G 1% /home
tmpfs tmpfs 13G 0 13G 0% /run/user/0
//192.168.20.230/data_moloch_raw cifs 7.0T 685G 6.4T 10% /data/moloch/raw
[root@localhost ~]#
客户段节点 创建开机自动挂载
写在 fstab, 如果挂载不成功, 能不能开机都是问题.
脚本中的密码不能带引号.
在bash命令行中密码带引号是没有问题的.
1 |
|
引用文献:
[1] mount.cifs 参数官方文档 https://linux.die.net/man/8/mount.cifs