Add a specified user to Samba and set password (user should already exist in system)

smbpasswd

  • Add/remove a Samba user or change its password.
    Samba users must have an existing local Unix account.
    More information: <https://manned.org/smbpasswd.8>.
  • Trick copyright: tl;dr; <https://github.com/tldr-pages/tldr>

sudo smbpasswd -a {{username}}

click the source code to copy install smbpasswd on any operating system with command-not-found.com