Log in to pe15
- Run the ssh client
Use the values in the table below to connect to pe15.
ssh configuration parameter value protocol ssh ssh version 2 ssh port 22 host pe15.cs.umb.edu user name your Unix username Authentication method password
- Enter your password
A dialog box will appear on the screen into which you must type the password for your Unix account.
Directory for this Exercise
(When you are ready for me to check this exercise, please scroll back up to where you entered these commands!)
- Make sure you are in your home directory
cd- Go to your it244 directory
cd it244- Go to your ex directory
cd ex- Create an ex09 directory
mkdir ex09- Go to your ex09 directory
cd ex09Create a typescript File
- Make sure you are in your ex09 directory
pwdIf the result of running this command is not~YOUR_UNIX_USERNAME/it244/ex/ex09where YOUR_UNIX_USERNAME is the name you created for your Unix account, see me.- Run the script command
script --flushThis will create a typescript file in your ex08 directory.
You must perform the remaining steps in this exercise while script is still running.
If you make a mistake, simply try again.
Do not exit the script session until you have finished all the steps in this exercise.Look at the Permissions of Files in a Directory
- Go to your home directory
cd- Make sure you are in your home directory
pwd- Look at the permissions assigned to the contents of your home directory
ls -l- Go to my home directory
cd ~ckelly- Make sure you are in my home directory
pwd- Look at the permissions assigned to the contents of my home directory
ls -lPractice with Permissions
- Go to your ex09 directory
cd ~/it244/ex/ex09- Make sure you are in the right directory
pwd- In a SEPARATE CLI window (same directory): Use nano to create the file name.txt
- Enter your name in this file and hit Enter
Then save the file (Control O) and exit (Control X) nano.
- Look at the permissions on this file
ls -l name.txtYou have read and write permission on this file
- Display the contents of name.txt
cat name.txtYou have read permission so you can run cat on it.
- In a SEPARATE CLI window (same directory): Open name.txt with nano
nano name.txtYou can only open the file if you have read permission.
- Add the city in which you live under your name and hit Enter again
Then save the file (Control O) and exit (Control X) nano.
- Display the content of the file again
cat name.txtYou have write permission so you were able to change the file.
- Remove write permission from this file
chmod 400 name.txt- Look at the permissions for this file
ls -l name.txtYou are the only one who has any permissions on this file.
And all you can do it read it.
- Display the contents of this file
cat name.txt- In a SEPARATE CLI window (same directory): Open the file with nano
nano name.txt- Try to add Massachusetts as the third line of this file
Try to save (Control O) and (Control X) quit.
You can't because you do not have write privileges.
- Quit nano
Control XWhen asked the following, press "N".Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ?- Look at the contents of this file
cat name.txtNothing has changed.
- Remove all privileges from this file
chmod 000 name.txt- Look at the permissions for this file
ls -l name.txt- Try to display the contents of the file
cat name.txtYou can't.
- In a SEPARATE CLI window (same directory): Try to open the file with nano
nano name.txtYou can't.
- Quit nano
Control X- Restore the original privileges
chmod 644 name.txt- Look at the permissions for this file
ls -l name.txt- Display the contents of this file
cat name.txtchmod with Numeric Arguments
- Go to your ex09 directory
cd ~/it244/ex/ex09- Make sure you are in the right directory
pwd- Create a test.txt file
touch test.txt- Look at the permissions on your test.txt file
ls -l test.txt- Remove read permission for all but the owner of the file
chmod 600 test.txt- Look at the permissions on your test.txt file
ls -l test.txt- Give read and write permission to everyone
chmod 666 test.txt- Look at the permissions on your test.txt file
ls -l test.txt- Restore the original permissions
chmod 644 test.txt- Look at the permissions on your test.txt file
ls -l test.txt- Delete test.txt
rm test.txtEnd your script Session
- Exit from your script session
exitYou need to do this or the typescript file will never be created- Look at the contents of the typescript file
cat typescriptBash Script for this Exercise
- Go to your ex09 directory
cd ~/it244/ex/ex09- Make sure you are in you ex09 directory
pwd- Create the script ex09.sh
nano ex09.sh- Write into this file the commands from the previous section
Only enter commands from the section chmod with numeric arguments.
- Save this file
Save and quit.
- Test the script
bash ex09.shFix any errors you find.
If you have trouble, see me.