What is Samba?
Samba is program which allows end users to access and use file, printers and other shared resources over a network. Shared resources can also be accessed by other operating systems like Windows or Mac.
In this Guide we will be installing and configuring samba on Ubuntu server to access a folder through windows and mac.
Requirements
- Ubuntu 16.04 or higher
- Local area network to access files across.
If you have all the things ready, let’s begin.
Installing Samba
- Before installing samba we will make sure all our repositories are update by using command below
sudo apt update
- Once the update is completed successfully we will be ready to install samba by using
sudo apt install samba
- Optional: To check if the installation of samba is successful or not we can use the command
whereis samba
- It should give you the following output
samba: /usr/sbin/samba /usr/lib/samba /etc/samba /usr/share/samba /usr/share/man/man7/samba.7.gz /usr/share/man/man8/samba.8.gz
Creating directory and setting up Samba Share
Now that we have installed samba we will be creating a new directory and sharing it across our network
- To create a directory we use the command mkdir
mkdir /home/<your user name>/share
- To configure samba file we need to go to the path which is etc/samba/smb.conf. To edit the samba configuration file use the below command
sudo nano /etc/samba/smb.conf
- Using the above command will open the configuration file and at the bottom of the file the following lines needs to be added in order to share the folder we have created earlier
[share]
comment = My first share on Ubuntu
path = /home/username/share
read only = no
browsable = yes - To save the file Ctrl+O (press and hold Ctrl button and press O) and to exit use Ctrl+X (press and hold Ctrl button and press X)
- Once we have successfully saved the configuration file we need to restart samba services by typing
sudo service smbd restart
or by using the following command below
sudo systemctl restart smbd
- Now in order to access the files from other computers on the network we will need to allow samba through ubuntu firewall, to update ubuntu firewall we will type
sudo ufw allow samba
- In order to access samba we need to create user password as it does not use default username password, to setup samba password for our user we will type
sudo smbpasswd -a username
In this post we have assumed that you already have a Ubuntu/Linux server installed but in case you want us to write a post on how to install samba server, let us know on the comments section below.
0 comments:
Post a Comment