Help: Centos 7 Samba setup

General support questions
Post Reply
tsinelas30
Posts: 3
Joined: 2017/01/27 03:19:53

Help: Centos 7 Samba setup

Post by tsinelas30 » 2017/01/27 03:24:40

Hi CentOS comm,

This is my first post here.

I am currently studying the centOS 7 to use as a file server in our company.
Now I am googling around but still having a problem on SMB.
Do you have any links here where I can follow the steps for samba?

Goal is to use centos 7 as a file server with user and group security.

I am using windows 10 now and a virtual box for my centos 7.

Below is the steps that I am following now.

Source from different sites.

1. Open Terminal
2. Login in as "su"
3. Paste the command "yum install samba samba-client samba-common -y"
4. When finished paste the command "mv /etc/samba/smb.conf /etc/samba/smb.conf.bkp"
5. Then Open "gedit /etc/samba/smb.conf"
6. It will show an editor containing the settings of the samba.
7. Paste this command (Note: You can modify the Share Definitions Part)
[global]
workgroup = WORKGROUP
server string = Samba Server %v
netbios name = centos
security = user
map to guest = bad user
dns proxy = no
#============================ Share Definitions ==============================
[Anonymous]
path = /samba/anonymous
browsable =yes
writable = yes
guest ok = yes
read only = no
8. Save and close the editor
9. Create a folder in terminal by this command "mkdir -p /samba/anonymous"
10. After creating a folder paste this commands "systemctl enable smb.service"
"systemctl enable nmb.service"
"systemctl restart smb.service"
"systemctl restart nmb.service"

systemctl stop firewalld
systemctl mask firewalld
yum install iptables-services
systemctl enable iptables
systemctl start iptablesmkdir
service iptables save

"sudo iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 137 -j ACCEPT"
"sudo iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 138 -j ACCEPT"
"sudo iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 139 -j ACCEPT"
"sudo iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 445 -j ACCEPT"
"sudo iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 901 -j ACCEPT"


11. When finish paste the command "gedit /etc/sysconfig/iptables" it will show the an editor with the settings of the iptables
12. Before the command -A INPUT -j REJECT --reject-with icmp-host-prohibited, add this commands (BOTTOM)
"-A INPUT -p tcp -m state --state NEW -m tcp --dport 137 -j ACCEPT"
"-A INPUT -p tcp -m state --state NEW -m tcp --dport 138 -j ACCEPT"
"-A INPUT -p tcp -m state --state NEW -m tcp --dport 139 -j ACCEPT"
"-A INPUT -p tcp -m state --state NEW -m tcp --dport 445 -j ACCEPT"
"-A INPUT -p tcp -m state --state NEW -m tcp --dport 901 -j ACCEPT"
13. Save the settings and close the editor.
14. Then Paste the command "service iptables restart"
15. Go to the folder location by browsing it into the terminal
cd /samba
chmod -R 0755 anonymous/
chown -R nobody:nobody anonymous/
chcon -t samba_share_t anonymous/

18. Try to access the CentOS share in your PC.

Secured Samba Server

1. Open Terminal
2. Login as "su"
1. Paste command "useradd user1"
2. Then paste command "groupadd group1"
3. When finished paste command "usermod -a -G group1 user1"
4. Put password in the smb user by this command "smbpasswd -a user1"
5. Type the desired password for the user that registered
6. Then if success a message will show Added user user1.
7. Create a folder in the terminal by entering this command "mkdir /home/secure"
8. Then paste the command "chown -R user1:group1 /home/secure/"
9. Then paste command "chmod -R 0770 /home/secure/"
10. Then paste command "chcon -t samba_share_t /home/secure/"
11. Open the editor containing the samba settings by this command "gedit /etc/samba/smb.conf"
12. Paste this command in the last page of the editor
[Secure]
path = /home/secure
valid users = @smbgrp
guest ok = no
writable = yes
browsable = yes
13. Save and close the editor
13. Then paste the command "systemctl restart smb.service"
14. Then paste the command "systemctl restart nmb.service"

synking
Posts: 6
Joined: 2011/10/31 19:07:12

Re: Help: Centos 7 Samba setup

Post by synking » 2017/01/27 08:00:04

Not sure what the full issue is but if you follow the steps here you should be able to get it setup.

https://www.unixmen.com/install-configu ... -centos-7/

Be careful with trying to share samba with host to guest connections in VirtualBox. There will be a lot of network configuration you would need to do for that seutp. It would be easier to share on a guest - guest network.

Laz
Posts: 1
Joined: 2018/10/19 07:01:17

Re: Help: Centos 7 Samba setup

Post by Laz » 2018/10/19 07:06:05

# systemctl start iptablesmkdir
Failed to start iptablesmkdir.service: Unit not found.

what is the correct comand to create the iptables direktory please?

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Help: Centos 7 Samba setup

Post by TrevorH » 2018/10/19 07:37:17

There is no such thing as iptablesmkdir.

The file used by the iptables service to save and restore its rules is /etc/sysconfig/iptables and you create or update that from the running rules by running service iptables save as root.
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

Post Reply