Skip to main content
Drupal 8

Main navigation

  • Home
    • Question And Answer
    • NEWS
    • Projects
  • Tutorials - Drupal
    • Android
    • Other
User account menu
  • Log in

Breadcrumb

  1. Home

Create a CIFS - SAMBA Network Share on Linux

By editor , 19 July, 2016
Question

How to create a CIFS (SAMBA) network on Linux (Debian, Ubuntu, Mint ...) ?

Simple way to create a cifs on debian linux based systems via command line interface (CLI).

Samba Server

Simple way to create a cifs on debian linux based systems via command line interface (CLI).

1. If not already insttalled, install SAMBA
sudo apt-get update
sudo apt-get install samba

2. Make directory to share
mkdir /home/<the_user_name>/<my_shared_folder>

3. Set User/Password
As samba use own user/password stroed in /etc/samba/smbpasswd, you must users/pass to this file.
sudo smbpasswd -a <the_user_name>

Note : <the_user_name> must have permission to read/write the share location, otherwise use chmod,chown to set permissions.

4. Add samba share to the file "/etc/samba/smb.conf" using vim, nano ...
Note : For the safety, Make a backup of this file
sudo cp /etc/samba/smb.conf ~
sudo vim /etc/samba/smb.conf

Example:
[<folder_name>]
path = /home/<the_user_name>/<my_shared_folder>
valid users = <the_user_name>
read only = no #yes/no

#Example
[share]
    comment = The share folder
    path = /var/www/docker
    browsable = yes
    guest ok = no
    read only = no
    create mask = 0755

5. Restart the samba server
sudo service smbd restart

 

Samba Client


You can test samba.conf using 'testparm'
To connect to the share, on linux you must use 'smbclient'

Example:
Note : folder_name is the name [<folder_name>] used on smb.conf file

sudo apt-get install smbclient
# List all shares:
smbclient -L //<HOST_IP_OR_NAME>/<folder_name> -U <user_name>
# connect:
smbclient //<HOST_IP_OR_NAME>/<folder_name> -U <user_name>

On Windows, just enter the url on file explorer
\\<HOST_IP_OR_NAME>\<folder_name>\

Tags

  • Server
  • Shell
Mount SAMBA NFS share folder on linux
Test disk read write speed on linux CLI

Comments

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.

Links

  • Drupal.org
  • Drupal core release cycle
  • Drupal events with ease
  • Unit test with Drupal using PHPUnit (Drupal 10)
  • Tokens for file upload url
  • Tips for Docker
  • CKEditor inline image files usage for custom forms.
  • Install Docker on Linux Mint
  • Install PHP 8.1
  • Drupal Security Best Practices
  • Order and sort items with tabledrag
  • Add a custom service YAML container
  • Apply a patch with composer