This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
blog:spring2016:mp010784:journal [2016/02/27 17:16] – [Week 5] mp010784 | blog:spring2016:mp010784:journal [2016/04/30 17:15] (current) – [Week 14] mp010784 | ||
---|---|---|---|
Line 190: | Line 190: | ||
After playing with whiptail and re-acclimating to bash scripting again after a year of not doing any bash scripting, I installed ssh daemon onto the samba server and created users for both Tyler and I and gave us both sudo privileges. | After playing with whiptail and re-acclimating to bash scripting again after a year of not doing any bash scripting, I installed ssh daemon onto the samba server and created users for both Tyler and I and gave us both sudo privileges. | ||
- | On Friday, Tyler and I started looking at the script we were gonna try to write and started looking into ways to share a session and we installed screen and tmux trying to do that ultimately to land on grabbing wemux, which we both still need to learn how to configure and use. https:// | + | On Friday, Tyler and I started looking at the script we were gonna try to write and started looking into ways to share a session and we installed screen and tmux trying to do that ultimately to land on grabbing wemux, which we both still need to learn how to configure and use. https:// |
+ | |||
+ | ====Week 6==== | ||
+ | |||
+ | On Monday Tyler and I looked at Tyler' | ||
+ | |||
+ | On Wednesday I started digging into a serious attempt to make an admin script as shown here: | ||
+ | < | ||
+ | # | ||
+ | ################################################## | ||
+ | # | ||
+ | # Something something dark side | ||
+ | # | ||
+ | # This is the admin script work in progress for | ||
+ | # the samba server | ||
+ | # -Matthew Page 03/ | ||
+ | # | ||
+ | ################################################## | ||
+ | |||
+ | ################################################## | ||
+ | # | ||
+ | # Functions, Functions, Functions!!! | ||
+ | # | ||
+ | ################################################## | ||
+ | |||
+ | ##quit function to break out of whole proogram | ||
+ | function quit { | ||
+ | exit 0 | ||
+ | } | ||
+ | |||
+ | ##This is the MAIN MENU function | ||
+ | function menu { | ||
+ | whiptail --title "Main Menu" --menu "" | ||
+ | |||
+ | choice=" | ||
+ | rm -rf ./ | ||
+ | |||
+ | if [ " | ||
+ | echo "Not quitting, doing something else" | ||
+ | |||
+ | case $choice in | ||
+ | Users) | ||
+ | echo "Doing something with users, eh?" | ||
+ | users #calling user submenu function | ||
+ | ;; | ||
+ | Passwords) | ||
+ | echo " | ||
+ | passwords | ||
+ | ;; | ||
+ | Groups) | ||
+ | echo " | ||
+ | groups | ||
+ | ;; | ||
+ | *) | ||
+ | echo " | ||
+ | ;; | ||
+ | esac | ||
+ | |||
+ | else | ||
+ | echo " | ||
+ | quit | ||
+ | fi | ||
+ | |||
+ | } | ||
+ | |||
+ | ##Users submenu (primary purpose for this script) | ||
+ | function users { | ||
+ | whiptail --title "User Creation Menu" --menu "" | ||
+ | choice=" | ||
+ | rm -rf ./ | ||
+ | |||
+ | if [ " | ||
+ | echo "Not quitting, doing something else" | ||
+ | |||
+ | case $choice in | ||
+ | Go_Back) | ||
+ | echo " | ||
+ | menu #calling main menu function | ||
+ | ;; | ||
+ | Add_Users) | ||
+ | echo "Need to implement something here to add users" | ||
+ | ;; | ||
+ | Delete_Users) | ||
+ | echo "Need to implement something here to delete users" | ||
+ | ;; | ||
+ | *) | ||
+ | echo " | ||
+ | ;; | ||
+ | esac | ||
+ | |||
+ | else | ||
+ | echo " | ||
+ | quit | ||
+ | fi | ||
+ | |||
+ | } | ||
+ | |||
+ | #Password submenu (if needed) | ||
+ | function passwords { | ||
+ | whiptail --title " | ||
+ | choice=" | ||
+ | rm -rf ./ | ||
+ | } | ||
+ | |||
+ | ##Groups submenu (if needed) | ||
+ | function groups { | ||
+ | whiptail --title " | ||
+ | choice=" | ||
+ | rm -rf ./ | ||
+ | } | ||
+ | |||
+ | |||
+ | #This Line doesn' | ||
+ | # | ||
+ | |||
+ | |||
+ | ################################################## | ||
+ | # | ||
+ | # Main Menu | ||
+ | # | ||
+ | ################################################## | ||
+ | |||
+ | menu | ||
+ | |||
+ | #whiptail --title "Main Menu" --menu "" | ||
+ | |||
+ | # | ||
+ | #rm -rf ./ | ||
+ | |||
+ | #if [ " | ||
+ | # echo "Not quitting, doing something else" | ||
+ | # | ||
+ | # case $choice in | ||
+ | # Users) | ||
+ | # echo "Doing something with users, eh?" | ||
+ | # users #This is designated to be a function call to a fucntion that doesn' | ||
+ | # ;; | ||
+ | # Passwords) | ||
+ | # echo " | ||
+ | # passwords | ||
+ | # ;; | ||
+ | # Groups) | ||
+ | # echo " | ||
+ | # groups | ||
+ | # ;; | ||
+ | # *) | ||
+ | # echo " | ||
+ | # ;; | ||
+ | # esac | ||
+ | # | ||
+ | #else | ||
+ | # echo " | ||
+ | # quit | ||
+ | #fi | ||
+ | |||
+ | exit 0 | ||
+ | </ | ||
+ | |||
+ | I came down with the flu, or something flu-like, so I missed Thursday and Friday this week and as of Sunday i feel a little better, hopefully I show up on Monday. | ||
+ | |||
+ | ====Week 7==== | ||
+ | |||
+ | This week I was sick and thus absent on Monday. | ||
+ | < | ||
+ | sudo useradd -m -g somegroup -s /bin/bash/ username | ||
+ | </ | ||
+ | |||
+ | In our case we don;t want them to have a shell so the -s and /bin/bash is being dropped. | ||
+ | |||
+ | < | ||
+ | sudo passwd username | ||
+ | </ | ||
+ | |||
+ | But this prompts the user twice (for verification) for the username. | ||
+ | |||
+ | < | ||
+ | sudo useradd -m -g student username -p encryptedpasswordhere | ||
+ | </ | ||
+ | |||
+ | except then we had to find out how to encrypt the password which we found when running the mkpassword on the unencrypted password would result in the encrypted password we needed. | ||
+ | |||
+ | < | ||
+ | mkpasswd poop | ||
+ | </ | ||
+ | which gave us something like this (it's different every time): 1apwqrzeX3VqE\\ | ||
+ | |||
+ | < | ||
+ | sudo useradd -m -g student joe -p 1apwqrzeX3VqE | ||
+ | </ | ||
+ | |||
+ | would give us a valid user joe with the password poop which we could login as. So we incorporated that into this script which became part of the whole user admin set of scripts: | ||
+ | < | ||
+ | #! /bin/bash | ||
+ | ttl=" | ||
+ | |||
+ | username=$(whiptail --backtitle " | ||
+ | if [ -z " | ||
+ | password=$(whiptail --backtitle " | ||
+ | if [ -z " | ||
+ | |||
+ | crypt=`mkpasswd " | ||
+ | sudo useradd -m -g student " | ||
+ | if [ " | ||
+ | |||
+ | exit 0 | ||
+ | </ | ||
+ | |||
+ | This successfully creates a user with the specified username and the specified password. | ||
+ | < | ||
+ | sudo deluser joe | ||
+ | </ | ||
+ | and | ||
+ | < | ||
+ | sudo rm -rf /home/joe | ||
+ | </ | ||
+ | |||
+ | which later we determined we could combine into one step by using an option for deluser: | ||
+ | < | ||
+ | sudo deluser joe --remove-home | ||
+ | </ | ||
+ | which we'll probably make into its own delete user script that gets incorporated into the mix next week. | ||
+ | |||
+ | ====Week 8==== | ||
+ | This week Tyler and I got our script successfully adding users and deleting users, we also made it so that the user (Barb) cannot delete admin users like Tyler or myself, or ultimately wedge who will be the lone person left to administer it after Tyler and I are gone...which reminds me, wedge still needs a user on the samba server. | ||
+ | *group wipe (deleting everyone in a group, like the student group at the end of a semester).\\ | ||
+ | *adding smbpasswd to the sudoers file of commands not requiring password entry.\\ | ||
+ | *Stopping and starting the samba server.\\ | ||
+ | *Possibly rebooting the whole machine option.\\ | ||
+ | *kicking a user, or implementing that in deluser script.\\ | ||
+ | |||
+ | Ongoing List:\\ | ||
+ | *organization.\\ | ||
+ | *error handling.\\ | ||
+ | *adding functions.\\ | ||
+ | ====Week 9==== | ||
+ | |||
+ | This week Tyler and I got an effective script going to manage a group wipe task. What I mean by this is to take all users from a group like " | ||
+ | |||
+ | < | ||
+ | students=`cat / | ||
+ | for s in $students; do sudo deluser --remove-home $s; done | ||
+ | </cli> | ||
+ | |||
+ | This we then incorporated into the rest of our whiptail and script directory structure. | ||
+ | |||
+ | ====Week 10==== | ||
+ | |||
+ | Tyler' | ||
+ | |||
+ | We also set up barb's account and made her shell the path to our actual script which we copied into her home directory, so that whenever she logs on it takes her directly to our script, and when she exits our script it exits the connection.\\ | ||
+ | |||
+ | This project is starting to look like it's starting to come to a close real soon. We just have to add some final polishing and maybe if there are any other features we want to add. But all of the originally planned features work and work as expected. | ||
+ | ====Week 11==== | ||
+ | |||
+ | This week Tyler and I are just shuffling stuff around in menus it seems. | ||
+ | |||
+ | We are also looking into potentially displaying some log information in our script as well. Currently we are playing with the output of last as seen below:\\ | ||
+ | {{http:// | ||
+ | Which we need to have our script parse through some of this data to see the last login times for each user is what I think we were leaning towards.\\ | ||
+ | |||
+ | We also may get a live test with the user who will actually be using this samba server and out admin script (barb) this week when she comes to give us the instructor reviews for the class sometime maybe this week. then we can hammer out anything that isn't intuitive or that may need further explanation or options for barb's everyday usage.\\ | ||
+ | |||
+ | On Thursday afternoon I stayed late in the LAIR and expected to run into Tyler Mosgrove but he was nowhere to be found. | ||
+ | < | ||
+ | sudo usermod -a g admin USERNAME_HERE | ||
+ | </ | ||
+ | But we may have decided that for Barb's purposes the two step method while more versatile may be too cumbersome and complicated for her usage, so that may be unnecessary. | ||
+ | |||
+ | Still we are planning to add a last login type aspect to our admin script which we still need to hammer out.\\ | ||
+ | |||
+ | ====Week 12==== | ||
+ | |||
+ | This week Tyler and I got a few more small things poliahed on our admin script for the samba file server. | ||
+ | |||
+ | < | ||
+ | ... | ||
+ | log file = / | ||
+ | ... | ||
+ | log level = 3 | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | Matt has also released all the eoce's this week (End Of Course Experience for the uninitiated)I' | ||
+ | |||
+ | On Wednesday, Tyler got the script' | ||
+ | |||
+ | Tyler got the special characters limitation for new usernames expression figured out and implemented and functioning correctly. | ||
+ | |||
+ | |||
+ | ====Week 13==== | ||
+ | |||
+ | Started working on the EOCE (End of Course Experience) this week.\\ | ||
+ | |||
+ | Tyler and I are also working on our submission of this project into CCC's Inspired series ending event which is a Sustainability Research Student Showcase of projects that students worked on this semester that pertain to one or many fo the facets of sustainability. | ||
+ | |||
+ | < | ||
+ | |||
+ | Dr.Powers, | ||
+ | |||
+ | This is a project submission on the behalf of Tyler Mosgrove & Mathew Page.\\ | ||
+ | |||
+ | The following project was conducted under the High Performance Computing program, and HPC Experience II class in room R108.\\ | ||
+ | |||
+ | The Systems Administration project is a solution to classroom needs.\\Specifically, | ||
+ | |||
+ | I hope this is an adequate explanation of this projects sustainability qualities. If you have any questions about the project feel free to contact us. We are looking forward to showcasing our project at the sustainability fair. | ||
+ | |||
+ | You will find the instructor' | ||
+ | |||
+ | Kind regards, | ||
+ | |||
+ | Tyler Mosgrove & Mathew Page | ||
+ | </ | ||
+ | |||
+ | ====Week 14==== | ||
+ | |||
+ | Continuing to work on this class' |