CentOS 7.2 安装配置Samba服务器(2)

[root@base samba]# smbclient -L localhost Enter root's password: Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba 4.4.4] Sharename Type Comment --------- ---- ------- FileShare Disk share some files WebDev Disk project development directory IPC$ IPC IPC Service (Ted Samba Server 4.4.4) Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba 4.4.4] Server Comment --------- ------- Workgroup Master --------- ------- [root@base samba]#

Linux访问

Samba服务端配置

[root@linuxidc.com webdev]# vim /etc/samba/smb.conf

内容如下

[global] workgroup = WORKGROUP server string = Samba Server Version %v netbios name = MYSERVER security = user passdb backend = tdbsam [tvms] path = /root/tvms-test public = yes valid user = root writeable = yes printable = no create mask = 0644 directory mask = 0755

在局域网内另外一台机器上,

挂载目录

安装cifs

[root@linuxidc.com ~]# yum -y install cifs-utils

挂载smb目录

[root@linuxidc.com ~]# mkdir /mnt/tvms [root@linuxidc.com ~]# mount //192.168.118.133/tvms /mnt/tvms Password for root@//192.168.118.133/tvms: * [root@linuxidc.com ~]# df -Th Filesystem Type Size Used Avail Use% Mounted on /dev/mapper/centos-root xfs 18G 988M 17G 6% / devtmpfs devtmpfs 479M 0 479M 0% /dev tmpfs tmpfs 489M 0 489M 0% /dev/shm tmpfs tmpfs 489M 6.7M 483M 2% /run tmpfs tmpfs 489M 0 489M 0% /sys/fs/cgroup /dev/sda1 xfs 497M 117M 381M 24% /boot tmpfs tmpfs 98M 0 98M 0% /run/user/0 //192.168.118.133/tvms cifs 18G 8.5G 9.1G 49% /mnt/tvms [root@linuxidc.com ~]# ll /mnt/tvms/ total 3952 drwxr-xr-x. 10 root root 0 Dec 21 03:40 suricata-3.1.2 -rw-r--r--. 1 root root 4042824 Dec 21 03:22 suricata-3.1.2.zip [root@linuxidc.com ~]#

输入密码:1

卸载目录

[root@linuxidc.com mnt]# umount /mnt/tvms/

如果出现

umount: /mnt/tvms: target is busy. (In some cases useful info about processes that use the device is found by lsof(8) or fuser(1))

可以使用fuser卸载

[root@linuxidc.com ~]# yum -y install psmisc [root@linuxidc.com ~]# fuser -m -v -i -k /mnt/tvms USER PID ACCESS COMMAND /mnt/tvms: root kernel mount /mnt/tvms root 2760 ..c.. bash Kill process 2760 ? (y/N) y Connection closed by foreign host. Disconnected from remote host(192.168.118.132) at 19:46:12. Type `help' to learn how to use Xshell prompt. [c:\~]$ Connecting to 192.168.118.132:22... Connection established. To escape to local shell, press 'Ctrl+Alt+]'. WARNING! The remote SSH server rejected X11 forwarding request. Last login: Wed Dec 21 03:27:53 2016 from 192.168.118.1 [root@linuxidc.com ~]# umount /mnt [root@linuxidc.com ~]# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/mapper/centos-root 18307072 1011444 17295628 6% / devtmpfs 490236 0 490236 0% /dev tmpfs 500680 0 500680 0% /dev/shm tmpfs 500680 6836 493844 2% /run tmpfs 500680 0 500680 0% /sys/fs/cgroup /dev/sda1 508588 118860 389728 24% /boot tmpfs 100136 0 100136 0% /run/user/0

自动挂载目录

[root@linuxidc.com ~]# vi /etc/fstab

添加如下内容

//192.168.118.133/tvms /mnt/tvms cifs defaults,username=root,password=1 0 0

重新挂载

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/c19931eb4bbe2a81343f98d4ce2df0e3.html