webminで新規ユーザーを作成するときにシェルスクリプトから追加したい
例えば複数のサーバーにwebminユーザーを作成するときなど、、、
まずは一度ユーザーを作成する
webminを開き「webmin」タブの「webminユーザー」を開く
「新しいWebminユーザを作成」をクリックして
ユーザー名とパスワードを入力して作成を押す
※この際、ユーザーの権限等も設定しておく
作成後、以下のファイルが作成されているか確認する
/etc/webmin/ユーザー名.acl
echo "rpc=2"
echo "nodot=0"
echo "webminsearch=1"
echo "uedit_mode=0"
echo "gedit_mode=0"
echo "feedback=2"
echo "otherdirs="
echo "readonly=0"
echo "fileunix=root"
echo "uedit="
echo "negative=0"
echo "root=/"
echo "uedit2="
echo "gedit="
echo "gedit2="
/etc/webmin/miniserv.users
ユーザー名:パスワードの乱数
例)test-user:password1234
/etc/webmin/webmin.acl
ユーザー名: webmincron usermin webminlog servers acl webmin change-user backup-config bacula-backup fsdump ldap-client ldap-useradmin mailcap mon pam at cron package-updates inittab syslog-ng system-status syslog man software mount quota passwd useradmin logrotate proc init apache bind8 dhcpd dovecot exim fetchmail jabber ldap-server mysql openslp postfix postgresql proftpd procmail qmailadmin sshd samba sendmail spam sarg squid wuftpd webalizer mailboxes adsl-client bandwidth fail2ban firewalld ipsec krb5 firewall6 firewall exports nis xinetd inetd pap ppp-client pptp-client pptp-server stunnel shorewall shorewall6 tcpwrappers idmapd net filter burner grub raid lvm smart-status vgetty iscsi-client iscsi-server iscsi-tgtd iscsi-target time lpadmin fdisk cluster-passwd cluster-copy cluster-cron cluster-shell cluster-software cluster-usermin cluster-useradmin cluster-webmin heartbeat filemin tunnel file phpini cpan telnet ajaxterm updown custom shell status htaccess-htpasswd
以下が作成したシェルスクリプトです。
ユーザー名の部分は各自変更してください。
#!/bin/bash
if [ ! -e /etc/webmin/ユーザー名.acl ];then
touch /etc/webmin/ユーザー名.acl
{
echo "rpc=2"
echo "nodot=0"
echo "webminsearch=1"
echo "uedit_mode=0"
echo "gedit_mode=0"
echo "feedback=2"
echo "otherdirs="
echo "readonly=0"
echo "fileunix=root"
echo "uedit="
echo "negative=0"
echo "root=/"
echo "uedit2="
echo "gedit="
echo "gedit2="
} >> /etc/webmin/ユーザー名.acl
echo 'ユーザー名:password1234' >> /etc/webmin/miniserv.users
echo "ユーザー名: webmincron usermin webminlog servers acl webmin change-user backup-config bacula-backup fsdump ldap-client ldap-useradmin mailcap mon pam at cron package-updates inittab syslog-ng system-status syslog man software mount quota passwd useradmin logrotate proc init apache bind8 dhcpd dovecot exim fetchmail jabber ldap-server mysql openslp postfix postgresql proftpd procmail qmailadmin sshd samba sendmail spam sarg squid wuftpd webalizer mailboxes adsl-client bandwidth fail2ban firewalld ipsec krb5 firewall6 firewall exports nis xinetd inetd pap ppp-client pptp-client pptp-server stunnel shorewall shorewall6 tcpwrappers idmapd net filter burner grub raid lvm smart-status vgetty iscsi-client iscsi-server iscsi-tgtd iscsi-target time lpadmin fdisk cluster-passwd cluster-copy cluster-cron cluster-shell cluster-software cluster-usermin cluster-useradmin cluster-webmin heartbeat filemin tunnel file phpini cpan telnet ajaxterm updown custom shell status htaccess-htpasswd" >> /etc/webmin/webmin.acl
/etc/init.d/webmin restart
fi