First step in my new DemoLab2022 is to get the fake users created.
Since this is home lab targeted I needed to figure out how to get the users a local but synced.
Being a Linux guy I knew how to script a local user, but needed to script smb and httpd users
Here is how I did it in Linux
useradd -u 1001 -G wheel -c "Alice Johnson" alice set +o history PASSWORD="xxxxxxxx" echo -e $PASSWORD"\n"$PASSWORD | passwd alice echo -e $PASSWORD"\n"$PASSWORD | smbpasswd -a alice htpasswd -b /etc/nagios/passwd alice $PASSWORD set -o history
Windows was easy, being a former windows admin
net user alice xxxxxxxx /ADD /FULLNAME:"Alice Johnson" net localgroup "Remote Desktop Users" "alice" /ADD
The NAS was a little different, something new for me, you cannot log in and user adduser to create accounts, you have to use the API. Luckily there were python examples. Here is the python example which is run from the linux box
#!/usr/bin/python3 import json import requests r = requests.post( "https://nas/api/v2.0/user/", auth=("root", "freenaspassword"), headers={"Content-Type": "application/json"}, verify=False, data=json.dumps({ "uid": "1001", "username": "alice", "home_mode": "755", "group_create": True, "password": "xxxxxxxx", "microsoft_account": True, "shell": "/usr/local/bin/bash", "full_name": "Alice Johnson", "email": "alice@demolab.local", }) ) print(r.text)
There were things that bugged me like the Cert not being legit (it is signed by an internal CA) and they recommended the user of a token to log in vs a username and password. But this worked.
Posting a little early today, going to which Spiderman No Way Home, yes it came out a few weeks ago, but waited for theaters to clear out before I went.
Weight: 351.8