Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

longy

Members
  • Joined

  • Last visited

  1. Attempting to Create Unraid Users Programmatically (CLI) I'm trying to automate user creation on Unraid without using the web GUI. Here's what I've tested and observed so far. Environment - Unraid 7.2.2, Slackware 15.0+, x86_64 What Works: System-Level User Creation Standard Linux commands create a user that works for system access and SMB: # Create system user useradd -u 1050 -g 100 -d / -s /bin/false newuser # Persist to boot config (survives reboot) grep "^newuser:" /etc/passwd >> /boot/config/passwd # Add shadow entry echo "newuser:x:$(( $(date +%s) / 86400 ))::::::" >> /boot/config/shadow # (Optional) Set SMB password echo -e "password\npassword" | smbpasswd -a newuser After running this, id newuser works, usermod -aG works, SMB authentication works. The user is fully functional at the system level. However, the user does not appear in the Unraid web GUI until the next reboot. After a reboot, the user does appear in the GUI. So whatever populates the GUI user list reads /boot/config/passwd at boot time. What the GUI Does When Creating a User (Observed via syslog) I monitored /var/log/syslog while creating a user called testgui through the web GUI. These entries appeared: emhttpd: shcmd (137): useradd -g users -d / -s /bin/false -c '' 'testgui' useradd: new user: name=testgui, UID=2003, GID=100, home=/, shell=/bin/false chpasswd: password changed for testgui emhttpd: Restarting services... emhttpd: shcmd (145): /etc/rc.d/rc.samba reload emhttpd: shcmd (148): exportfs -ra emhttpd: shcmd (150): /etc/rc.d/rc.avahidaemon reload emhttpd: shcmd (155): cp /etc/passwd /etc/shadow /var/lib/samba/private/smbpasswd /boot/config Observations: - emhttpd calls useradd without specifying a UID (auto-assigned) - It uses chpasswd to set the password - It reloads samba, NFS exports, and avahi - It copies /etc/passwd, /etc/shadow, and smbpasswd FROM /etc/ TO /boot/config/ File Monitoring (inotifywait) I ran inotifywait on /boot/config/passwd, /boot/config/shadow, /boot/config/smbpasswd, and /var/local/emhttp/users.ini while creating a user through the GUI. The write events observed were: /boot/config/passwd MODIFY /boot/config/shadow MODIFY /boot/config/smbpasswd MODIFY /var/local/emhttp/users.ini DELETE_SELF The users.ini file received a DELETE_SELF event — it appears to be deleted and recreated rather than appended to. What I Tried That Doesn't Work 1. emcmd (Unraid's CLI tool) /usr/local/sbin/emcmd "cmdUserEdit=Add&userName=newuser&userPassword=$(echo -n 'pass' | base64)&userPasswordConf=$(echo -n 'pass' | base64)" emcmd is a PHP script at /usr/local/emhttp/plugins/dynamix/scripts/emcmd that uses curl_socket to post to /var/run/emhttpd.socket at the path http://localhost/update. The call blocks indefinitely. No useradd entry appears in syslog even after waiting 30+ seconds. I tried: - Backgrounding with nohup and & - Running via at job scheduler (fully detached) - Killing the process after various timeouts (5s, 10s, 15s, 30s) - Using /update.htm as the path instead of /update - Writing a custom PHP script using curl_socket directly None of these produced a user. No emhttpd: shcmd: useradd entry ever appeared in syslog from any CLI-initiated attempt. Interestingly, emcmd DOES work for deleting users that were created through the GUI: /usr/local/sbin/emcmd "cmdUserEdit=Delete&userName=testgui" This also blocks, but the user IS deleted (confirmed via id and syslog showing userdel). 2. Direct socket writes Tried posting directly to the emhttpd socket using PHP stream_socket_client, curl with CURLOPT_UNIX_SOCKET_PATH, and bash. Responses were either HTTP 500, 0 bytes received (timeout), or the connection hung. 3. curl via nginx with session cookie curl -sk -c cookies.txt -X POST https://nas.local/login -d 'username=root&password=xxx' -L curl -sk -b cookies.txt -X POST https://nas.local/update.htm -d 'cmdUserEdit=Add&...' Returns 502 Bad Gateway — nginx times out waiting for a response. 4. Appending to users.ini I appended a properly formatted entry to /var/local/emhttp/users.ini. The entry was present in the file (confirmed with grep), but the user did not appear in the GUI. Refreshing the page, clearing cache, etc. had no effect. The user only appeared after a reboot. 5. GraphQL API The GraphQL endpoint at /graphql is active on Unraid 7.2.2, but user management mutations don't exist. Tested addUser, createUser, setUser, updateUser — all return "Cannot query field on type Mutation." Questions 1. Is there a supported way to create users from the command line that the GUI will recognize without a reboot? 2. Is there a command or signal to refresh the GUI's user list from /boot/config/passwd? 3. Why does emcmd cmdUserEdit=Delete work but cmdUserEdit=Add appears not to? 4. Are there plans to add user management to the GraphQL API? Current Workaround Using useradd + config file writes. The user is fully functional for system and SMB access immediately. GUI visibility requires a reboot. Functional but not ideal for automation. Summary Method User Created? In GUI? Deletable from GUI? GUI (Add User) Yes Yes Yes useradd + config files Yes After reboot only Not tested emcmd cmdUserEdit=Add No (hangs) N/A N/A Direct socket write No N/A N/A curl via nginx No (502) N/A N/A Append to users.ini N/A No N/A GraphQL API No (no mutation) N/A N/A
  2. I'm looking at creating my own RBAC script to initiate users, groups and apply acls at boot time on each startup. The issue is that I can't find a way to add users via command line that has them show up in the webGUI adding a user via useradd results in them showing in /etc/passwd but not in the webgui and not in /boot/passwd e.g. useradd -m -g users -G downloads,software testuser2 Does anyone know of a way to programatically add a user with a specified UID, GID and also have it show up in the webGUI too? Then it would be easier/closer to having a script that would be a rudimentary RBAC that could initialise and run on each startup without user intervention. I've gotten most of it working but I'm just missing the automation of user creation. Any insight, would be appreciated :)
  3. Hi, I want to create new users and specify their UID at creation. I've created some as a test via cli and they don't show in the gui. Reason being I want to script permissions and for NFS shares, I will be using service accounts with static UIDs across multiple vm's mounting NFS to unraid. So consistency is much eaiser to manage. Iwould like to specify static UIDs and GIDs on startup since Unraid doesn't have proper support for groups yet, or maybe ever. Is there anyway I can create users with specific UIDs? Is there a plugin that adds an option to the Add User screen to specify the UID at creation?

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.