ETSU Logo

CSCI 1210

Essentials of Web Development

Scripts Cheatsheet

This is a list of useful scripts on the CSCI1210.com server. The scripts are located in /home/jack/scripts. I usually cd to that directory and run the scripts from there (too lazy to add a global scripts directory and add it to $PATH). The usage examples all show their scripts being run from that directory

You could run them by specifying the path from any directory, i.e., /home/jack/scripts/ufwcheck.sh. In that case, there's no need for the './' prepending the script name

Script

addgroups.sh

Usage

sudo ./addgroups.sh [group_names.txt]

Description

Adds groups (as user accounts) for project work.
Required: input file, text, one group name per line

Notes

Sets up groupname, account, virtual domain, and FTP

Script

addusers.sh

Usage

sudo ./addusers.sh [user_names.txt]

Description

Adds user accounts
Required: input file, text, one user name per line

Notes

Sets up username, account, virtual domain, and FTP

Script

cheat.sh

Usage

./cheat.sh [language_name]
./cheat.sh -h #for help listing

Description

Provides information about various languages

Notes

Experimental

Script

christmas.sh

Usage

./christmas.sh

Description

Make a pretty Christmas tree

Notes

n/a

Script

ckusers.sh

Usage

sudo ./ckusers.sh
sudo ./ckusers.sh > users.txt
   # pipes output to file

Description

Lists user accounts. Can be used in conjunction with addusers.sh and/or delusers.sh.

Notes

*Make sure to edit before running so you don't delete users you want to keep*

Script

delusers.sh

Usage

sudo ./delusers.sh [user_names.txt]

Description

Deletes user accounts & subdomains

Notes

Use with caution - irrevocable

Script

iplookup.sh

Usage

sudo ./iplookup.sh [path_to_file]

Description

Checks for illegal login attempts. Logs IP addys for offenders w/ > 100 attempts. Creates output file for addtoufw.sh

Notes

2nd parameter usually /var/log/auth.log

Script

lockdirs.sh

Usage

sudo ./lockdirs.sh [user_names.txt] [path_to_dir]

Description

Locks folders to prevent users from uploading files after they are due (had a real problem with that last semester)

Notes

Path to locked dir is relative to user domain, e.g., /labs/lab5 would lock /var/www/html/ramseyjw.csci1210.com/labs/lab5

Script

lockmt.sh

Usage

sudo ./lockmt.sh [user_names.txt]

Description

Locks users' /midterm folders

Notes

Old: can use ./lockdirs.sh instead, if needed

Script

nossh.sh

Usage

sudo ./nossh.sh [user_names.txt]

Description

Prevents selected users from remote-connecting to the server (PuTTY)

Notes

* depricated - built in to ./addusers.sh now

Script

rmfiles.sh

Usage

sudo ./rmfiles.sh [user_names.txt]

Description

Deletes all files larger than 2MB from user directories. Used before archiving students' work @ end of semester

Notes

2MB is the default > can change in code

Script

shelltemplate.sh

Usage

n/a

Description

Used as template for new scripts. Checks permissions and # of parameters

Notes

n/a

Script

ufwadd.sh

Usage

sudo ./ufwadd.sh ufwadd.txt

Description

Adds naughty IP addresses (output from ./iplookup.sh) to firewall

Notes

ufwadd.txt is output by ./iplookup.sh

Script

ufwcheck.sh

Usage

sudo ./ufwcheck.sh

Description

Displays paginated numbered list of firewall rules

Notes

n/a