Skip to content

Commit

Permalink
fix: Hide smbpasswd output
Browse files Browse the repository at this point in the history
  • Loading branch information
kroese authored Apr 11, 2024
1 parent 27ee2dc commit 92b8791
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions samba.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ mkdir -p "$share" || { echo "Failed to create directory $share"; exit 1; }

# Check if the smb group exists, if not, create it
if ! getent group "$group" &>/dev/null; then
groupadd "$group" > /dev/null || { echo "Failed to create group $group"; exit 1; }
groupadd "$group" || { echo "Failed to create group $group"; exit 1; }
fi

# Check if the user already exists, if not, create it
if ! id "$USER" &>/dev/null; then
adduser -S -D -H -h /tmp -s /sbin/nologin -G "$group" -g 'Samba User' "$USER" > /dev/null || { echo "Failed to create user $USER"; exit 1; }
adduser -S -D -H -h /tmp -s /sbin/nologin -G "$group" -g 'Samba User' "$USER" || { echo "Failed to create user $USER"; exit 1; }
fi

# Get the current user and group IDs
Expand Down Expand Up @@ -71,7 +71,7 @@ else
fi

# Change Samba password
echo -e "$PASS\n$PASS" | smbpasswd -a -c "$config" -s "$USER" || { echo "Failed to change Samba password for $USER"; exit 1; }
echo -e "$PASS\n$PASS" | smbpasswd -a -c "$config" -s "$USER" > /dev/null || { echo "Failed to change Samba password for $USER"; exit 1; }

# Start the Samba daemon with the following options:
# --foreground: Run in the foreground instead of daemonizing.
Expand Down

0 comments on commit 92b8791

Please sign in to comment.