Linux Samba User Add Script

Problem: The User Password Sync on Standalone Samba Server like Debian & Ubuntu without LDAP is broken since years!

So i wrote a small Script called add-user-smb.sh:

#!/bin/bash

# Prompt for username
read -p "Username: " username

# Prompt for password without echoing
read -p "Password: " password

# Add a new User to Linux 
sudo useradd -m $username
echo "$username:$password"| sudo chpasswd

# Add same User to SAMBA Subsystem with same Password!
sudo smbpasswd -a $username<<EOF
$password
$password
EOF

Impressum Datenschutz-DSGVO-GDPR

Last Update 08.10.2023 www.linuxonlinehelp.eu - Nonprofit Linux PC & Server Support since 2004 Tags: Linux Online Help, Linuxonlinehelp, Linux Support, Linux Hilfe