Skip to main content

Special Commands and Scripts

There are several commands and scripts that have been added to Polaris to make life easier for those who manage it. Professors and Helpdesk staff will have access to several or all of the commands listed below.

Class Creation

Given a list of users and some details on the class/project, automatically create users, course directory, administration group, student-specific submission folders, and administration permissions. The tool is also useful for fixing permissions of existing course directories, simply omit the userlist flag and point the -d flag at the target directory.

Professors must be added to the %profs group to grant them sudo permissions for this command. Please submit a helpdesk ticket to be added.

Flags:

[-u userlist.txt]      | File containing list of AD usernames of class members, separated by newline. @clarkson.edu will be stripped. Omit to simply apply permissions or skip subdirectory creation. 
-p <professor>         | AD username of professor
-d <path to class>     | Full path to existing class dir, e.g. /data/class/cs141. Will be the parent directory for permissions and directory creation. Will be created if it does not exist. 
[-s semester]          | Semester, format with s or f followed by two digit year - e.g., f21 or s22. Will be the subdirectory containing student folders, when omitted student folders will be created in the parent course directory.
-g <admin group>       | Group name for the course administration e.g., cs141-admin. Will be created if it does not exist.
[-t]                   | Prompt for adding additional accounts to the course admin group (TAs, other proffessors, etc.)
[-w]                   | Web mode - creates a public_html folder in the given course directory with proper permissions. Changes the behavior of the [-u userlist] and [-s semester] flags - 
                          makes public student folders within the webroot, optionally in a subdirectory thereof set by the semester flag. If you are using this tool to fix permissions of a class that
                          has existing web directories, first run without the web flag but with any other necessary flags, and then run a second time with just the web flag (or -u and -s depending on need).

SSH into polaris and run the following:

sudo class_init [-u userlist file] -d <path to class dir> [-s semester] -g <class admin group> -p <professor username> [-t] [-w]

Sample: 

sudo class_init -u ./tocreate_cs141.txt -d /data/class/cs141/ -s f25 -g cs141-admin -p picardjl -t

The above will:

  • Create user accounts for all listed in the ./tocreate_cs141.txt file if they do not already exist
  • Create a directory called f25 in /data/class/cs141/ owned by picardjl
  • Create a group called cs141-admin and add picardjl to it
  • Create a submission directory for each student, owned by the student and cs141-admin, allowing access to only the particular student and members of the cs141-admin group
  • Prompt you for TA names (whose accounts will be created if they do not already exist) and add them to the cs141-admin group

For setting up a course/project with a lin-web/people.clarkson.edu webpage, use the -w flag:

Sample: 

sudo class_init -u ./cs675.txt -d /data/class/cs675/ -s f25 -g cs675-f25-admin -p picardjl -w

The above will:

  • Create user accounts for all listed in the ./cs675.txt file if they do not already exist
  • Create a group called cs675-f25-admin and add picardjl to it
  • Create a directory called f25 in /data/class/cs675/public_html owned by picardjl:cs675-f25-admin
  • Create a webfolder subdirectory for each student in /data/class/cs675/public_html/f25, owned by the student and the cs675-f25-admin, allowing write access to only the particular student and members of the cs675-f25-admin group
  • Make the course accessible at https://lin-web.clarkson.edu/class/cs675/

Add to Class

A complement to the above class creation script, the add_to_class script adds a single user to a class, creating their directories and permissions as needed.

Professors must be added to the %profs group to grant them sudo permissions for this command. Please submit a helpdesk ticket to be added.

add_to_class [-u USER] [-c CLASS] [-s SEMESTER]
  -u USERNAME: Name of the user to be added to the class (Will create if it doesn't exist)
  -c CLASS: Class for the user to be added to
  -s SEMESTER: Semester of the class for the user to be added to

For adding user picardjl to class CS141 for Sememster s26

sudo add_to_class -u picardjl -c cs141 -s s26