File sharing between Windows and CentOS8 through Samba
File sharing between Windows and CentOS8 through Samba
Hello, I am trying to set up file sharing between my windows domain and centOS8 using samba and am having a few difficulties. This is only my first week using centOS so I am still very new to this.
I am using a VM for this. Hostname for CentOS is trj and it was successfully joined to the domain(computer account created in ADUC). I also enabled SMB in windows programs/features. My share that I created is named myshare in /mnt.
I started running into issues when: (I originally did username=user) I will also post my two files i've edited. What it boils down to, is I cannot connect to the centos VM from my windows environment. It is pingable but I cannot access the share through file explorer. If anyone can tell me if I'm missing something or help point me in the right direction, it would be appreciated!
I am using a VM for this. Hostname for CentOS is trj and it was successfully joined to the domain(computer account created in ADUC). I also enabled SMB in windows programs/features. My share that I created is named myshare in /mnt.
I started running into issues when: (I originally did username=user) I will also post my two files i've edited. What it boils down to, is I cannot connect to the centos VM from my windows environment. It is pingable but I cannot access the share through file explorer. If anyone can tell me if I'm missing something or help point me in the right direction, it would be appreciated!
Last edited by tyler.r on 2021/04/09 15:27:43, edited 1 time in total.
Re: File sharing between Windows and CentOS8 through Samba
Here are the /etc/fstab and /etc/samba/smb.conf files i've edited.
Just in case too, heres my directory that's trying to be shared under /mnt
Last edited by tyler.r on 2021/04/09 15:26:42, edited 1 time in total.
Re: File sharing between Windows and CentOS8 through Samba
Not a wise idea to post passwords in plain text even if part of an image. I removed it.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Re: File sharing between Windows and CentOS8 through Samba
First, it would be nice if you could copy-paste text from VM rather than screenshot.
You mount with -o username=root but smbclient -U user. Should you use the same account for both?
(Furthermore, your account is 'trj', yet another identity.)
The 'myshare' shares path /share. What is in there? ls -la /share
You mount with -o username=root but smbclient -U user. Should you use the same account for both?
(Furthermore, your account is 'trj', yet another identity.)
The 'myshare' shares path /share. What is in there? ls -la /share
Re: File sharing between Windows and CentOS8 through Samba
Ah, yes, non-standard paths like /share will need selinux action to be taken. Read /etc/samba/smb.conf.example for how to do so.
Some configurations of samba also require you to use the smbpasswd command to set up the user in question. In any case, it's not wise to attempt to use root for it.
Some configurations of samba also require you to use the smbpasswd command to set up the user in question. In any case, it's not wise to attempt to use root for it.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Re: File sharing between Windows and CentOS8 through Samba
A slightly off the wall thought, do you need Samba, or would running your own cloud achieve the same result? I run OwnCloud (though NextCloud has plenty of supporters, YMMV) hosted on a C8 machine. It's accessible from Win10, Win7, Fedora, Alma, Springdale, C7 and Raspian.
Re: File sharing between Windows and CentOS8 through Samba
My apologies, I haven't posted on forums very much. I will look into selinux for the smb.conf & avoid using root(I did a -o username=user first). I don't know if anything else is needed, but I did a
semanage fcontext -a -t samba_share_t "/share(/.*)?"
restorecon -R -v /share
And then started and enabling smb/nmb with systemctl.
I already set smbpasswd -a user, This is purely a testing environment, no need to actually implement it, I am just trying to learn! What's located in /share is just a test file right now.
total 0
drwxrwxrwx. 3 root root 18 Apr 9 08:32 .
dr-xr-xr-x. 18 root root 237 Apr 9 08:01 ..
drwxr-xr-x. 2 user user 6 Apr 9 08:32 test
semanage fcontext -a -t samba_share_t "/share(/.*)?"
restorecon -R -v /share
And then started and enabling smb/nmb with systemctl.
I already set smbpasswd -a user, This is purely a testing environment, no need to actually implement it, I am just trying to learn! What's located in /share is just a test file right now.
total 0
drwxrwxrwx. 3 root root 18 Apr 9 08:32 .
dr-xr-xr-x. 18 root root 237 Apr 9 08:01 ..
drwxr-xr-x. 2 user user 6 Apr 9 08:32 test
-
- Posts: 135
- Joined: 2014/06/17 21:50:37
Re: File sharing between Windows and CentOS8 through Samba
I have to mount windows shares on Linux servers quite a bit here. This is a procedure I have worked out.
Define a remote machine and a share name
Create a mountpoint
Create a directory to store credential files in
Create a credential file. I name it /etc/.credentials/$MACHINE/$SHARE. The credential file has two or three lines. The domain entry is usually optional.
Set the permissions on the credential file
Test with mount
Test with smbclient
Add to fstab (make appropiate substitutions)
Mount
Define a remote machine and a share name
Code: Select all
export MACHINE="abc.def.xyz"
export SHARE="fooshare"
Code: Select all
sudo mkdir -p /smbfs/$MACHINE/$SHARE
Code: Select all
sudo mkdir -p -m 0700 /etc/.credentials/$MACHINE
Code: Select all
username=<user>
password=<password>
domain=<domain>
Code: Select all
sudo chmod 0600 /etc/.credentials/$MACHINE/$SHARE
Code: Select all
sudo mount -t cifs //$MACHINE/$SHARE /smbfs/$MACHINE/$SHARE -o credentials=/etc/.credentials/$MACHINE/$SHARE
Code: Select all
sudo smbclient //$MACHINE/$SHARE -A /etc/.credentials/$MACHINE/$SHARE
Code: Select all
//$MACHINE/$SHARE /smbfs/$MACHINE/$SHARE cifs credentials=/etc/.credentials/$MACHINE/$SHARE,defaults,users,auto,uid=oracle,gid=dba 0 0
Code: Select all
sudo mount -a