Scripts
+ Sample login script - logon.cmd.
@echo off
cls
echo.
echo ###############################################################################
echo.
echo.
echo Hello %USERNAME% welcome to [COMPANY NAME] Server %LOGONSERVER%
echo.
echo.
echo ###############################################################################
echo.
:COMMON
echo Synchronising time with %LOGONSERVER%
net time %LOGONSERVER% /set /yes > NULL
rem not needed as a 2000 network has time sync built in from the PDC
echo.
echo Mapping user personal drives
net use v: \\[SERVERNAME]\[SHARENAME]\%USERNAME% /PERSISTENT:NO /yes > NULL
echo.
echo Mapping common network drives
net use /persistent:no > NULL
net use g: \\[SERVERNAME]\[SHARENAME] /PERSISTENT:NO /yes > NULL
del NULL
:next
echo Next Task
echo.
if exist "%USERPROFILE%\logon.bat" goto usrlgin1
if exist C:\logon.bat goto usrlgin2
goto end
:usrlgin1
"%USERPROFILE%\logon.bat"
goto end
:usrlgin2
C:\logon.bat
goto end
echo Logon complete
:end
#!/bin/bash
USER=$1
NOTE="Samba Admin User"
if [ -z $USER ] ; then
echo "Admin User Name (no spaces)"
read USER
fi
if [ -z $USER ] ; then
echo "You must enter a user name. Aborting"
exit
fi
echo "Adding admin user: $USER"
#---------------------------------------------
# Delete the user if they exist
#---------------------------------------------
echo "Deleting samba account"
smbpasswd \
-x \
"$USER"
echo "Deleting linux account"
userdel "$USER"
#---------------------------------------------
# Add the new user as a Unix user
#---------------------------------------------
echo "Adding admin user: $USER"
useradd \
-g smbusers \
-G admin,apache \
-d "/home/$USER" \
-s "/bin/bash" \
-c "$NOTE" \
"$USER"
echo "Setting password for user: $USER"
passwd $USER
#---------------------------------------------
# Setup the SAMBA account
#---------------------------------------------
echo "Adding samba account"
smbpasswd \
-a \
"$USER"
#---------------------------------------------
# Create home directory in SAMBA
#---------------------------------------------
mkdir /data/docs/$USER
chown -R $USER /data/docs/$USER
chmod -R 750 /data/docs/$USER
# Create profile directory in SAMBA
mkdir /data/profiles/$USER
chown -R $USER /data/profiles/$USER
chmod -R 750 /data/profiles/$USER
#!/bin/bash
USER=$1
NOTE="Computer account"
if [ -z $USER ] ; then
echo "Computer Name (no spaces)"
read USER
fi
if [ -z $USER ] ; then
echo "You must enter a computer name. Aborting"
exit
fi
echo "Adding computer---->: $USER"
#---------------------------------------------
# Delete the computer if they exist
#---------------------------------------------
echo "Deleting samba account"
smbpasswd \
-x \
"$USER$"
echo "Deleting linux account"
userdel "$USER$"
#---------------------------------------------
# Add the computer as a Unix user
#---------------------------------------------
echo "Adding linux user: $USER"
useradd \
-g machines \
-G machines \
-d "/dev/null" \
-s "/bin/false" \
-c "$NOTE" \
"$USER$"
#---------------------------------------------
# Setup the SAMBA account
#---------------------------------------------
echo "Adding samba account"
smbpasswd \
-a \
-m \
"$USER$"
#!/bin/bash
USER=$1
NOTE="Samba User"
if [ -z $USER ] ; then
echo "Normal User Name (no spaces)"
read USER
fi
if [ -z $USER ] ; then
echo "You must enter a computer name. Aborting"
exit
fi
echo "Adding normal user: $USER"
#---------------------------------------------
# Delete the user if they exist
#---------------------------------------------
echo "Deleting samba account"
smbpasswd \
-x \
"$USER"
echo "Deleting linux account"
userdel "$USER"
#---------------------------------------------
# Remove all old directories
#---------------------------------------------
#rm -rf /tmp/*$USER
#rm -rf /home/$USER
#rm -rf /data/docs/$USER
#rm -rf /data/profiles/$USER
#---------------------------------------------
# Add the new user as a Unix user
#---------------------------------------------
echo "Adding user: $USER"
useradd \
-g smbusers \
-G smbusers \
-d "/home/$USER" \
-s "/bin/bash" \
-c "$NOTE" \
"$USER"
passwd $USER
#---------------------------------------------
# Setup the SAMBA account
#---------------------------------------------
echo "Adding samba account"
smbpasswd \
-a \
"$USER"
#---------------------------------------------
# Create home directory in SAMBA
#---------------------------------------------
mkdir /data/docs/$USER
chown -R $USER /data/docs/$USER
chmod -R 750 /data/docs/$USER
# Create profile directory in SAMBA
mkdir /data/profiles/$USER
chown -R $USER /data/profiles/$USER
chmod -R 750 /data/profiles/$USER
Click here to check out the list of other projects.
You may also like to click here to check out the list of Artificial Intelligence projects.
If you would like to get any further information on this or any of the other projects shown on this web site, please send an email to Acacia Lateral Technologies. or place a comment in our Guest Book
You might also like to submit your idea to our Free Ideas page for the benefit of other like-minded soles.