Post

Replies

Boosts

Views

Activity

SMB credentials check on Sonoma
I can't anymore check SMB credentials on macOS. Sonoma stops checking them after first successful validation. No matter which way to go, it could be smbutil, mount_smbfs, or even the NetFSMountURLSync function from the NetFS framework. Below is a script that works fine on Ventura, but would fail on Sonoma. There are three smbutil calls. The first call includes the correct username and password, the second omits the password, the third goes with an incorrect password. On Ventura and earlier the second and third calls fail, but Sonoma feels okay. The same could be seen with mount_smb. Is it a normal behavior? Is there a way to check credentials on Sonoma? #!/bin/bash # SMB server or its ip address SERVER="127.0.0.1" RESOURCE="Test" # username and password to authenticate on the server USER_NAME="username" USER_PASSWORD="password" # path to mount server resource MOUNT_POINT="/tmp/1" function Raise { echo "!!! ERROR: $1" exit 1 } /usr/bin/smbutil view -ANf "//${USER_NAME}:${USER_PASSWORD}@${SERVER}" || Raise "Unable to browse shares with credentials" /usr/bin/smbutil view -ANf "//${USER_NAME}:@${SERVER}" && Raise "Successfully browsed shares without password" /usr/bin/smbutil view -ANf "//${USER_NAME}:foobar@${SERVER}" && Raise "Successfully browsed shares with incorrect password" mkdir -p "/tmp/1" mount_smbfs -s "//${USER_NAME}:${USER_PASSWORD}@${SERVER}/${RESOURCE}" "/tmp/1" || Raise "Unable to mount share with credentials" diskutil unmount "/tmp/1" mkdir -p "/tmp/1" mount_smbfs -s "//${USER_NAME}:foobar@${SERVER}/${RESOURCE}" "/tmp/1" && Raise "Successfully mounted with incorrect password" diskutil unmount "/tmp/1"
4
3
1.7k
Nov ’23