H1, let’s see what you need to do when you want share files between windows and linux. There are mroe ways how you can do it, and one is to install and configure samba service on your server. After successfull installink you can conect trough file explorer to \\server-ip\path\to\folder or you can map this path to letter like disk for example S:. So let’s start:
Install samba
1sudo apt update
2sudo apt install samba
3
4# check status
5sudo systemctl status smbd
Configure firewall (optional)
1sudo ufw allow 'Samba'
Create Backup of configuration files
1sudo cp /etc/samba/smb.conf{,.backup}
Configuration
1sudo nano /etc/samba/smb.conf
Defailt values
server role = standalone serverinterfaces = 127.0.0.0/8 eth0Listen on all interfacesbind interfaces only = yes
Ater changes you can test config file with testparm. If everythinq si OK you will see Loaded services file OK
Restart Samba services with:
1sudo systemctl restart smbd
2sudo systemctl restart nmbd
Folders
Instead of using default folder create new location for example /samba
1sudo mkdir /samba
And change group to default samba’s group sambashare
1sudo chgrp sambashare /samba
Create samba users
Create users with following command
1sudo useradd -M -d /samba/maymeow -s /usr/sbin/nologin -G sambashare maymeow
-Mdo not create home directory-d /samba/maymeowset users directory to/samba/maymeow-s /usr/sbin/nologindisable shell access to th-G sambashareadd user tosambasharegroup
Create home directory for this user and chage directory permission
1sudo mkdir /samba/maymeow
2sudo chown maymeow:sambashare /samba/maymeow
3
4sudo chmod 2770 /samba/josh
Add user to samba by setting password for account
1sudo smbpasswd -a maymeow
Once you have password you can enable account
1sudo smbpasswd -e maymeow
You can create more users by following this seps if you need them.
Configuring Samba shares
1sudo nano /etc/samba/smb.conf
1[users]
2 path = /samba/users
3 browseable = yes
4 read only = no
5 force create mode = 0660
6 force directory mode = 2770
7 valid users = @sambashare @sadmin
8
9[emma]
10 path = /samba/maymeow
11 browseable = no
12 read only = no
13 force create mode = 0660
14 force directory mode = 2770
15 valid users = maymeow @sadmin
Some notes
pathpath to sharebrowseablewhether thw folder is listed or no in shares list. By setting tonousers cannot see this share in listread onlywhether thevalid usershave abilty to write to this folder.force create modepermissions for newly created filesforce directory modepermissions for newly created foldersvalid userslist of users that are allowed to acces this folder. one with@prefix are groups
That’s all for now. Thank you for reading.