Install Samba Server Windows

Posted on by admin
Install Samba Server Windows 5,5/10 9183 votes

How to Set Up an SMB Server in OS X and Windows 8. Smb:// Just what the heck is a Samba or SMB server anyways? Well, a Server Message Block is just the protocol that. Samba is a free/open source and popularly used software for sharing files and print services between Unix-like systems including Linux and Windows hosts on the same network. In this guide, we will show how to setup Samba4 for basic file sharing between a Ubuntu systems and Windows machines. One of the most common ways to network Ubuntu and Windows computers is to configure Samba as a File Server. This section covers setting up a Samba server to share files with Windows clients. The server will be configured to share files with any client on the network without prompting for a password.

In our last article, we showed how to install Samba4 on Ubuntu for basic file sharing between Ubuntu systems and Windows machines. Where we looked at configuring anonymous (unsecure) as well as secure file sharing.

Here, we will describe how to install and configure Samba4 on CentOS 7 (also works on RHEL 7) for basic file sharing between other Linux systems and Windows machines.

Important: Starting from version 4.0, Samba can run as an Active Directory (AD) domain controller (DC). We suggest you read through our special series on setting up Samba4 Active Directory Domain Controller, which includes critical topics for Ubuntu, CentOS, and Windows.

Install Samba4 in CentOS 7

1. First install Samba4 and required packages from the default CentOS repositories using the yum package manager tool as shown.

2. After installing the samba packages, enable samba services to be allowed through system firewall with these commands.

Open Samba on Firewalld

Check Windows Machine Workgroup Settings

3. Before you proceed to configure samba, make sure the Windows machine is in the same workgroup to be configured on the CentOS server.

There are two possible ways to view the Windows machine workgroup settings:

  • Right clicking on “This PC” or “My Computer” → PropertiesAdvanced system settingsComputer Name.
  • Alternatively, open the cmd prompt and run the following command, then look for “workstation domain” in the output as shown below.

Verify Windows WorkGroup

Configuring Samba4 on CentOS 7

4. The main samba configuration file is /etc/samba/smb.conf, the original file comes with pre-configuration settings which explain various configuration directives to guide you.

But, before configuring samba, I suggest you to take a backup of the default file like this.

Server

Then, proceed to configure samba for anonymous and secure file sharing services as explained below.

Samba4 Anonymous File Sharing

5. First create the shared directory where the files will be stored on the server and set the appropriate permissions on the directory.

Also, you need to change the SELinux security context for the samba shared directory as follows.

6. Next, open the samba configuration file for editing, where you can modify/add the sections below with the corresponding directives.

Samba Configuration Settings

7. Now verify current samba settings by running the command below.

8. Finally, start and enable samba services to start automatically at next boot and also apply the above changes to take effect.

Testing Anonymous Samba File Sharing

9. Now on the Windows machine, open “Network” from a Windows Explorer window, then click on the CentOS host, or else try to access the server using its IP address (use ifconfig command to get IP address).

Shared Network Hosts

10. Next, open the Anonymous directory and try to add files in there to share with other users.

Add Files to Samba Anonymous Share

Setup Samba4 Secure File Sharing

11. First start by creating a samba system group, then add users to the group and set a password for each user like so.

12. Then create a secure directory where the shared files will be kept and set the appropriate permissions on the directory with SELinux security context for the samba.

13. Next open the configuration file for editing and modify/add the section below with the corresponding directives.

14. Again, verify the samba configuration settings by running the following command.

Verify Secure Configuration Settings

15. Restart Samba services to apply the changes.

Testing Secure Samba File Sharing

16. Go to Windows machine, open “Network” from a Windows Explorer window, then click on the CentOS host, or else try to access the server using its IP address.

ServerInstall

You’ll be asked to provide your username and password to login the CentOS server. Once you have entered the credentials, click OK.

Install Samba Server Windows 7

17. Once you successfully login, you will see all the samba shared directories. Now securely share some files with other permitted users on the network by dropping them in Secure directory.

Samba Secure Share Directory

You can also check out these useful articles concerning Samba file sharing on a network.

In this guide, we showed you how to setup Samba4 for anonymous and secure file sharing between CentOS and other Linux systems as well as Windows machines. Share any thoughts with us via the comment section below.

Share

Install Smb Windows Server 2012

I had some problems with connecting my Windows 10 computer to my Ubuntu 16.04.1's samba server. Finally I got it.

So how to share files on the Ubuntu 16 server with Windows 10 computers?

user3069376user3069376

2 Answers

First, if you made any changes to an existing samba configuration, revert them, or delete the /etc/samba/smb.con and uninstall samba.

I assume your Ubuntu server username is peterlustig and the Ubuntu server IP is 192.168.2.42.

  1. sudo apt-get install samba
  2. sudo cp -pf /etc/samba/smb.conf /etc/samba/smb.conf.bak Just backup your config
  3. sudo mkdir /myshares- what you want to share via Samba
  4. sudo chown peterlustig:peterlustig /myshares
  5. sudo chmod 777 /myshares or experiment with lower rights, I havn't done that yet
  6. sudo smbpasswd -a peterlustig Adds the user peterlustig to the Samba database and activates it. (Usually different password than peterlustig in Ubuntu itself. The password is what you need to enter later when connecting with the Windows 10 client to the server, step 10)
  7. sudo nano /etc/samba/smb.conf And add the following to the bottom of the file:

  8. sudo /etc/init.d/samba restart restart your server and reload the config

  9. If you use the ufw Firewall, you need to configure it. E.g. I allow only 192.xxx.xxx.xxx hosts to access my Samba shares, so I entered: sudo ufw allow from 192.0.0.0/8 to any app Samba
  10. In the Windows 10 client, open a Windows Explorer and enter the IP address of your host: 192.168.2.42. Now you should see your shared folder named my-shared-folder-name from step 8 in the [] brackets. Open it. Now you need to enter your credentials, i.e. username peterlustig and the password you entered in step 6.

You can even map it as Windows network drive. Address will be 192.168.2.42my-shared-folder-name, and don't forget to enable using different credentials (than your Windows 10 user provides) and enter peterlustig and password from step 6 there.

Hope this helped anyone. Happy sharing!

George Udosen
23k10 gold badges52 silver badges78 bronze badges
user3069376user3069376

Restart Ubuntu after fresh installation and add user

smb.conf required settings

In authentication section turn 'map to guest = bad user' off by adding # at starting of code (Must)

You can try adding this line if it's not working (replace with your username):

Add your personal code at the end

Alamjit SinghAlamjit Singh

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