Just because I'm kind of amnesic and need something somewhere to remember how to install quickly samba
on a desktop (or server)
Simply run this command.
sudo apt install samba samba-common smbclient
Once samba
is installed, you'll have 2 choices:
- Create a new shared folder
- Use an existing folder
For the first choice, you can do it that way:
mkdir -pv /path/to/your/folder
Now you'll have to edit the configuration file /etc/samba/smb.conf
with your prefer text editor. In my case I'll use nano
.
sudo nano /etc/samba/smb.conf
Feel free to comment all default shares you won't use.
Then add your share like this at the end of the file (change here to fit your needs) :
[share-name]
comment = Share for VMs
path = /path/to/your/folder
browsable = yes
guest ok = yes
read only = yes
create mask = 0700
directory mask = 0700
I wanted my shared folder to be in
read only
mode but if you want it writable, you should change tono
.
Now, restart the services to apply your changes.
sudo systemctl restart smbd nmbd
You can use testparm
and smbclient
to test and verify your settings.
testparm
Specify your password or press enter
if none set.
smbclient -L [host ip]
If everything looks good for you, you may be able to access to your shares remotely from any devices that support the
SMB
protocol.
sudo ufw allow from [network] to any app Samba
sudo ufw status verbose