Created
September 8, 2015 01:57
-
-
Save cmattoon/8f824c5b164f070e14aa to your computer and use it in GitHub Desktop.
RedStar OS /tmp/usersetting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ "$1x" != "x" ];then | |
. $1 | |
fi | |
isExist=`cat /etc/group | grep admin:x` | |
if [ "$isExist" = "" ]; then | |
cat /etc/group>/tmp/group.tmp | |
echo "Adding 'admin' group..." | |
groupadd -f -o -g 0 admin | |
admingroup=`cat /etc/group | grep admin:x` | |
echo $admingroup>/etc/group.bak | |
cat /tmp/group.tmp>>/etc/group.bak | |
mv -f /etc/group.bak /etc/group | |
rm -f /tmp/group.tmp | |
fi | |
isExist=`cat /etc/group | grep staff` | |
if [ "$isExist" = "" ]; then | |
echo "Adding 'staff' group..." | |
groupadd -f -o -g 90 staff | |
fi | |
isExist=`cat /etc/group | grep Guest` | |
if [ "$isExist" = "" ]; then | |
echo "Adding 'Guest' group..." | |
groupadd -f -o -g 89 Guest | |
fi | |
#JSH: needed for KYG: 2012.09.23 | |
groupadd -r com.rs.sharepoint.everybody | |
isExist=`cat /etc/passwd | grep Guest` | |
if [ "$isExist" = "" ]; then | |
echo "Adding 'Guest' user..." | |
useradd -o -u 89 -s /sbin/nologin -g Guest -G Guest -c "Guest Account" Guest | |
passwd -d Guest | |
smbpasswd -a -n Guest | |
fi | |
usermod -g root -G admin,staff -s /sbin/nologin -c "System Administrator" root | |
passwd -d root | |
usermod -p '!!' root | |
smbpasswd -a -n root | |
if [ "x$SHORTNAME" == "x" ];then | |
exit 0 | |
fi | |
/usr/sbin/useradd "$SHORTNAME" -g "$SGROUP" | |
if [ "x$NAME" != "x" ];then | |
/usr/bin/chfn -f "$NAME" "$SHORTNAME" | |
fi | |
if [ "x$PASSWORD" != "x" ];then | |
/usr/sbin/usermod -p "$PASSWORD" "$SHORTNAME" | |
else | |
/usr/bin/passwd -d "$SHORTNAME" | |
fi | |
/usr/sbin/usermod -g "$SGROUP" -G "$FGROUP" "$SHORTNAME" | |
#JSH: we need /root/* holders for generall users | |
#mkfolders /home/$SHORTNAME | |
#mkfolders /root # but this runs every time | |
#JSH: from RyangKyongIl | |
if [ "x$PASSWORD" != "x" ];then | |
/usr/bin/smbpasswd "$SHORTNAME" -a -s < /tmp/.pass.tmp | |
else | |
/usr/bin/smbpasswd "$SHORTNAME" -a -s -n | |
fi | |
rm -f /tmp/.pass.tmp | |
#JSH: for samba setting of every user -- YunHakMin need | |
#echo "\[$SHORTNAME's Public Folder\]" >> /etc/samba/smb.conf # we don't need global sharing | |
echo "[$SHORTNAME's Public Folder]" >> /etc/samba/smb.conf | |
echo "path = /home/$SHORTNAME/Public" >> /etc/samba/smb.conf | |
#echo "force user = root" >> /etc/samba/smb.conf # we don't need force user | |
echo "valid users = $SHORTNAME, Guest, +staff" >> /etc/samba/smb.conf | |
#echo "read list = guest" >> /etc/samba/smb.conf | |
echo "read list = Guest, +staff" >> /etc/samba/smb.conf | |
echo "guest ok = yes" >> /etc/samba/smb.conf | |
echo "read only = no" >> /etc/samba/smb.conf | |
#echo "admin users = root" >> /etc/samba/smb.conf | |
#echo "admin users = $SHORTNAME" >> /etc/samba/smb.conf | |
echo "write list = $SHORTNAME" >> /etc/samba/smb.conf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment