Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Last revision Both sides next revision | ||
litespeed_wiki:lsmcd:user_cpanel [2020/07/07 15:33] Jackson Zhang [LSMCD Secure User Data CloudLinux/cPanel Interface] |
litespeed_wiki:lsmcd:user_cpanel [2020/07/07 15:40] Jackson Zhang [Administration] |
||
---|---|---|---|
Line 32: | Line 32: | ||
Users must be created in advance and must match their cPanel user names. Passwords and stats can be managed by the users themselves using the cPanel plugin described here. | Users must be created in advance and must match their cPanel user names. Passwords and stats can be managed by the users themselves using the cPanel plugin described here. | ||
+ | There is a way to automatically create a user for each cPanel user for WHM administrator. You may use a script like the following when you ssh login as a root user: | ||
+ | |||
+ | <code> | ||
+ | #!/bin/bash | ||
+ | |||
+ | user_list=$(sasldblistusers2 /etc/sasllsmcd | cut -d@ -f1) | ||
+ | #get current user list | ||
+ | |||
+ | for name in $(ls /home/); | ||
+ | do | ||
+ | if [[ -d /home/$name/public_html ]] ; then | ||
+ | #check public_html existance to make sure it's vhost user instead of cPanel created dir | ||
+ | if ! echo $user_list | grep -i -q $name ; then | ||
+ | #check if user already in the list to avoid override existing users | ||
+ | passwd=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 10 ; echo '') | ||
+ | echo $passwd | saslpasswd2 -p -f /etc/sasllsmcd $name | ||
+ | # use -p to set a random password without prompt | ||
+ | echo "$name added into LSMCD" | ||
+ | else | ||
+ | echo "$name already in the list..." | ||
+ | fi | ||
+ | fi | ||
+ | done | ||
+ | </code> | ||
+ | |||
+ | You can also use the similar commands to create a custom script, and hook up with cPanel user creation to auto-run it. | ||
+ | |||
+ | passwd=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 10 ; echo '') | ||
+ | echo $passwd | saslpasswd2 -p -f /etc/sasllsmcd $name | ||
===== Use ===== | ===== Use ===== | ||
Once the software is installed, cPanel users will see a new option in their **Advanced** group: | Once the software is installed, cPanel users will see a new option in their **Advanced** group: |