1

I am struggling to have one CentOS machine access a Samba share hosted by another CentOS machine. This is in a mixed OS environment that requires it.

The host is CentOS 7 and for years has hosted files to Windows machines. I have built a new machine based on CentOS however it cannot access the Samba share successfully. Cryptically, Windows 7 virtual machines hosed by this new machine can access the Samba shares just fine, the host itself cannot.

I have disabled selinux setenforce 0, disabled iptables systemctl stop iptables and disabled firewalld systemctl stop firewalld, all on the server. I have tried to make sure the workgroups are the same. I have tried making sure the user and group ids for the same named user are the same on each machine usermod -u <id> <user>, groupmod -g <id> <user>.

When using the gnome GUI, the 'Windows Network' cannot be browsed. 'Unable to access location. Failed to retrieve share list from server: No such file or directory'.

When using the 'Connect to Server' with smb://<user>@<ip>/<share> it asks for the domain and password for which I give the workgroup name and the user password. This is met with 'Unable to access location. Failed to mount Windows share: Connection refused'

When using the terminal with mount.cifs -o username=<user>,workgroup=<workgroup> //<ip>/<share> <mount location>, I am prompted for a password, upon giving it, the command returns 'Unable to find suitable address'.

When using smbtree, no results are returned.

What more can I do to understand and resolve this problem?

1 Answer 1

1

Linux machines make clumsy Samba clients, as you are discovering. It isn't at all surprising that the Windows guests on the new CentOS machine have no difficulty connecting to the Samba server because they're fully fledged Windows machines, after all, simply connecting through the virtual network on their host and then the LAN to the Samba server. All the CentOS host provides from the Windows guests' perspective is a network connection, its own connection difficulties notwithstanding.

Better between Linux machines to use SSH. SSH server is doubtless already on the Samba server host, because Samba requires it. It's simple enough then to configure login user-wise or for scheduled jobs using key-based (i.e., passwordless) authentication from the new Linux system, so that the connection is transparent to the user. Then, one can use sshfs and a corresponding fstab entry for a local mount point. You'll need to manually line up user accounts on all machines (real and virtual) or think about LDAP or upgrading your Samba server to be a domain controller.

You will have an added bit of complexity if you want the Windows guests on the new CentOS host to have access to local storage on the CentOS host. The optimal configuration for that is a Samba server on the new CentOS host to serve local files to local guests. This quickly takes one down the rabbit hole of configuring multiple Samba servers on the same network, LDAP/Samba AD DC, and perhaps other joy. An alternative might be for the existing Samba host to ssh to the new CentOS machine, mount the latter's storage directories using sshfs & fstab, and then serve those mounts as Samba shares. Regardless, you may find it more elegant simply to skip all this and simply rely on the existing Samba host for file services and associated storage.

4
  • This is a great response, I'm struggling to follow it however. It seems like your final statement suggests three is a very simple solution, which of the above is that solution? Will a Samba host be able to serve the windows network and serve the same files via SSH with no extra configuration on the server side? Can I use the same SSH connection from the client machine by just duplicating the users from the server?
    – J Collins
    Oct 18, 2019 at 14:20
  • The simple solution is to have a single file server. That server can host both Samba (smbd) and SSH (sshd), and via either serve the same files. Each user will have to authenticate on the file server regardless. That is, the file server must have an account for each user (which doubtless already is the case if Samba is configured) and the user must present credentials to get access. For Samba, that occurs by a user's logging onto a Windows client. For SSH, that can occur simply by a user's logging onto a Linux client if key-based authentication and an sshfs mount are configured.
    – ebsf
    Oct 22, 2019 at 16:49
  • Remember, SSH is a full-blown terminal/shell, allowing any authenticated user from anywhere to do anything s/he could do on the host machine itself. It isn't just for file services. So, some "extra configuration" likely is needed. For function, you'll probably need to configure sshd to enable the sftp subsystem. For security, attend to host user permissions and privileges; harden sshd (via /etc/ssh/sshd_config); harden the host firewall (via iptables or ufw) and kernel (via /etc/sysctl.conf); configure logging (syslog); and secure the network perimeter with its own firewall and NAT.
    – ebsf
    Oct 22, 2019 at 19:41
  • The configuration files I mention are for Debian/Ubuntu; you should confirm the correct ones for CentOS.
    – ebsf
    Oct 22, 2019 at 19:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.