If smbpasswd is run as root, then on the local machine it doesn't prompt for the existing user password. However, if you run smbpasswd -U <user> -r <remote> as root you get prompted for the user's old password on the remote machine first. Unless you get this right, the new password cannot be set. In my case, root passwords on both machines are identical. If you give the correct remote user's password then you can set a new password, so there seems to be nothing wrong in the connection between machines.