Create samba share on linux

About This Guide

In this text, I teach how to create a network share via Samba using the CLI (Command-line interface/Linux Terminal) in an uncomplicated, simple and brief way targeting Windows users.

Procedures

sudo apt-get update sudo apt-get install samba
Note: Samba uses a separate set of passwords than the standard Linux system accounts (stored in /etc/samba/smbpasswd), so you'll need to create a Samba password for yourself. This tutorial implies that you will use your own user and it does not cover situations involving other users passwords, groups, etc.
Tip1: Use the password for your own user to facilitate.
Tip2: Remember that your user must have permission to write and edit the folder you want to share. Eg.: sudo chown /var/opt/blah/blahblah sudo chown : /var/opt/blah/blahblah
Tip3: If you're using another user than your own, it needs to exist in your system beforehand, you can create it without a shell access using the following command : sudo useradd USERNAME --shell /bin/false You can also hide the user on the login screen by adjusting lightdm's configuration, in /etc/lightdm/users.conf add the newly created user to the line : hidden-users=
sudo nano /etc/samba/smb.conf
Once "smb.conf" has loaded, add this to the very end of the file: [] path = /home// valid users = read only = no
Tip: There Should be in the spaces between the lines, and note que also there should be a single space both before and after each of the equal signs.
sudo service smbd restart

sudo apt-get install smbclient # List all shares: smbclient -L /// -U # connect: smbclient /// -U

Note: The default user group of samba is "WORKGROUP".

Source

How to Create a Network Share Via Samba Via CLI (Command-line interface/Linux Terminal) — Uncomplicated, Simple and Brief Way! (последним исправлял пользователь 97e64b0f 2015-10-06 20:46:34)

Читайте также:  Уровень системного администратора linux

The material on this wiki is available under a free license, see Copyright / License for details
You can contribute to this wiki, see Wiki Guide for details

Источник

Install and Configure Samba

A Samba file server enables file sharing across different operating systems over a network. It lets you access your desktop files from a laptop and share files with Windows and macOS users.

This guide covers the installation and configuration of Samba on Ubuntu.

What you’ll learn

What you’ll need

If you have everything ready, let’s dive straight into the installation process on the next step!

Originally authored by Aden Padilla.

2. Installing Samba

sudo apt update sudo apt install samba 

We can check if the installation was successful by running:

The following should be its 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 

3. Setting up Samba

Now that Samba is installed, we need to create a directory for it to share:

The command above creates a new folder sambashare in our home directory which we will share later.

The configuration file for Samba is located at /etc/samba/smb.conf . To add the new directory as a share, we edit the file by running:

sudo nano /etc/samba/smb.conf 

At the bottom of the file, add the following lines:

[sambashare] comment = Samba on Ubuntu path = /home/username/sambashare read only = no browsable = yes 

Then press Ctrl-O to save and Ctrl-X to exit from the nano text editor.

What we’ve just added

Now that we have our new share configured, save it and restart Samba for it to take effect:

sudo service smbd restart 

Update the firewall rules to allow Samba traffic:

Читайте также:  Linux mount файловая система

4. Setting up User Accounts and Connecting to Share

Since Samba doesn’t use the system account password, we need to set up a Samba password for our user account:

sudo smbpasswd -a username 

Note
Username used must belong to a system account, else it won’t save.

Connecting to Share

ubuntuctn

On Ubuntu: Open up the default file manager and click Connect to Server then enter:

macosctn

On macOS: In the Finder menu, click Go > Connect to Server then enter:

On Windows, open up File Manager and edit the file path to:

Note: ip-address is the Samba server IP address and sambashare is the name of the share.

Samba

You’ll be prompted for your credentials. Enter them to connect!

If you’d like to take your configuration further…

Источник

Оцените статью
Adblock
detector