/SI110/Cyber Battlefield/Operating Systems/Activities Using Shell on Remote Host (rona) 1. Open Windows shell (command prompt). Type “cmd” in the Windows search box, click on cmd.exe 2. Remotely connect to the computer “rona”. Enter: ssh mXXXXXX@rona.academy.usna.edu where mXXXXXX is m(your alpha code) – Say “Yes” when the Security Alert window pops up (this only happens the first time, as long as you say “Yes”). Enter your USNA password – the cursor will not move, so don’t expect to see asterisks or anything to show how many characters you typed. NOTE: The prompt will not say your username, no drive letter, it just says rona[101][~]$. 3. Find the name of the host. Enter: hostname result: ______________________________ Compare to a classmate’s result. 4. Find out your username. Enter: whoami result: ______________________________ Compare to a classmate’s result. 5. Enter: pwd result: ___________________________ so, what does this command do? ___________________________________________________ Note that this is your home directory in rona and the path is equivalent to ~. 6. Enter: cd .. What happens?______________________________________________ Note the prompt change. 7. Type: pwd again. Compare results to the hierarchy diagram on page 2. Does this make sense? Understand WHERE YOU ARE in the hierarchy! 8. List the contents of the directory. Enter: ls You will see a listing of all users on rona (this directory is equivalent to the C:/Users directory in Windows). What is the Windows equivalent command to list the contents of the directory? ___________ 9. “Go to” someone else’s directory. Enter: cd mYYYYYY (where YYYYYY is the alpha of someone else in the results from 9.) 10. List all processes running on the host. Enter: ps –ef Notice all of the different users (first column) all using the same computer and processes. 11. View someone else’s directory contents (testing OS permissions enforcement). Enter: ls 12. What happened? ______________________________________________________ Why?____________________________________________ 13. Show the contents of your home directory from current location. Enter: ls /home/mXXXXXX NOTE: In UNIX /home/mXXXXXX is an absolute path and is equivalent to the Windows C:\Users\mXXXXXX path on your computer. 14. Enter: cd ~ to return to your home directory (from ANYWHERE in the rona file system hierarchy). ~ is also an absolute path in Unix – to your home directory. 15. Enter: ls –a (the –a option shows hidden files in the home directory) You should see the file readme.txt 16. View the contents of a file in the shell. Enter: cat readme.txt (What is the Windows equivalent command for this?)________ 17. Did you see a file named foo.txt when you typed “ls”? _________ 18. Copy a file. Enter: cp readme.txt foo.txt 19. Enter: ls 1 20. Now do you see the file foo.txt? 21. Enter: cat foo.txt Is this file the same or different from readme.txt? Why? ___________________________ 22. Editing a file’s contents IN THE SHELL. nano is a program in UNIX that allows you to edit text in the shell. Enter: nano foo.txt 23. Modify the contents of foo.txt (just type some stuff or delete some stuff). 24. Exit nano, saving the file (hit crtl+x and answer y to save and then press enter to keep the filename the same.) 25. Enter: cat foo.txt Did you see your changes in foo.txt? 26. Delete a file. Enter: rm foo.txt 27. Enter: ls Is the file foo.txt gone from the listing? 28. Open the course’s resource web page and click on “windowsunixdictionary” near the bottom of the page; 29. Arrange the rona shell window and the “windowsunixdictionary” page side by side. 30. On rona, make your home directory look like the tree structure pictured below using the commands in the windowsunixdictionary for UNIX. This involves creating a new folder and creating two text files using nano. Commands you should have used in this activity: hostname, whoami, pwd, ls, cd, cp, mkdir, rm, cat, nano Commands not used, but you should know: rmdir (same as rmdir Windows), mv (same as move in Windows) Diagram for step 31 END OF THIS ACTIVITY Another test of permissions on rona 1. get a classmate's alpha code YYYYYY 2. Enter: cat /home/mYYYYYY/readme.txt 3. You should be able to explain what happens and WHY. END OF THIS ACTIVITY 2