Page 1 of 1

mount shared folder on another CentOS

Posted: 2018/08/03 14:45:28
by RizONE
Hi
I need make shared folder on first CentOS and open it from 2nd CentOS. Both of them is Minimal.
On first:
yum install samba samba-common
chkconfig --level 345 smb on
service smb start
chmod -R 775 /tmp
/etc/samba/smb.conf
[global]
workgroup = SAMBA
security = user
passdb backend = tdbsam
host allow = 192.168.10.2

[tmp]
path = /tmp
browsable = yes
writable = yes
read only = no
guest ok = yes

service smb reload

On second:
yum install samba-client
mount -t cifs //192.168.10.1/tmp /tmp

and get error
mount: wrong fs type, bad option, bad superblock on....

What is going wrong?

Re: mount shared folder on another CentOS

Posted: 2018/08/03 14:49:03
by TrevorH
Did you open your firewall on the server machine to allow the right ports?

Re: mount shared folder on another CentOS

Posted: 2018/08/03 14:53:11
by RizONE
firewall is disabled
[root@localhost samba]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)

Aug 02 05:51:31 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon...
Aug 02 05:51:31 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.
Aug 03 09:47:05 localhost.localdomain systemd[1]: Stopping firewalld - dynamic firewall daemon...
Aug 03 09:47:06 localhost.localdomain systemd[1]: Stopped firewalld - dynamic firewall daemon.
[root@localhost samba]#

Re: mount shared folder on another CentOS

Posted: 2018/08/03 15:06:57
by RizONE
after
yum install cifs-utils
on second centOS and its work! But asked a password

Re: mount shared folder on another CentOS

Posted: 2018/08/03 16:30:00
by RizONE
from client CentOS
[root@localhost mnt]# smbclient -L 192.168.10.1
Enter SAMBA\pkpvd's password:
Anonymous login successful

Sharename Type Comment
--------- ---- -------
pkpvd_opt Disk pkpvd Directories
IPC$ IPC IPC Service (Samba 4.7.1)
Reconnecting with SMB1 for workgroup listing.
Anonymous login successful
Server Comment
--------- -------
Workgroup Master
--------- -------
SAMBA LOCALHOST
WORKGROUP ADMIN

but steel can't mount it

Re: mount shared folder on another CentOS

Posted: 2018/08/04 13:05:06
by hunter86_bg
Your SAMBA host is exporting "/tmp" but by default it has the following SELINUX context:
$ ls -lZd /tmp
drwxrwxrwt. root root system_u:object_r:tmp_t:s0 /tmp
Thus , I'm pretty sure that your SAMBA server cannot provide access to your client.
In order to verify that , run

Code: Select all

setenforce 0 && getenforce
Then just restart your smb and nmb services and try again.

Re: mount shared folder on another CentOS

Posted: 2018/08/06 08:34:55
by RizONE
SELINUX is turned off
After smbpasswd -a root on first CentOS I can get access to shared folder from second CentOS using
sudo mount -vt cifs //192.168.10.2/pkpvd_opt /opt

How should I configyre /etc/fstab on second CentOS?
//192.168.10.2/pkpvd_opt /opt ext4 defaults 0 0
Is that right?