smbclient -L //server -U user

Samba and NFS Share Builder

Share a directory over the network. Pick Samba or NFS and get the config block, the permissions to set, and the client mount command.

Subnet or host. NFS requires this.

Which one to use

NFS is faster and preserves Unix ownership and permissions properly, which makes it the right choice between Linux machines you control. Samba works with everything including Windows and macOS, handles authentication rather than trusting IP addresses, and is what you want if any client is not Linux. NFS access control is essentially the client IP, so never export to the internet. Both need the underlying directory permissions to be correct: the share config cannot grant access the filesystem denies.

Generate Samba shares and NFS exports

This share generator writes a Samba smb.conf block or an /etc/exports line for sharing a directory across a home network. It covers read-only versus writable, host and subnet restrictions, create masks and forced group ownership, root squashing on NFS, and Time Machine support on Samba, along with the commands to validate the config, set directory ownership, and mount the share from a client.

Samba and NFS FAQ

Why can I see the share but not write to it?

Almost always filesystem permissions rather than the share config. The share can only permit what the underlying directory already allows for the user the server runs as. Check ownership and mode on the directory itself, and remember Samba applies create mask on top.

Why is my Samba password rejected when the system password works?

Samba keeps its own password database. A system account is not automatically a Samba account. Run smbpasswd -a username to create the Samba credential, which can differ from the login password.

What does root_squash do and should I disable it?

It maps requests from the client root user to an unprivileged account, so a root user on any allowed machine cannot rewrite files as root on the server. Leave it on. Disabling it means anyone who can become root on a client, which on their own laptop is everyone, is effectively root on the export.

Should I open these ports to the internet?

No. SMB in particular has a long history of exploited vulnerabilities and is a favourite target of scanners and ransomware. Keep both on the LAN and reach them over a VPN when away. The WireGuard config generator sets that up.