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>\
Comments