This lesson introduces you to Unix, an OS you probably are not familiar with. Part and parcel with that, we'll learn how to use a Unix machine remotely - i.e. use it even though we don't have physical access to it - using a tool called ssh. The Unix command shell is similar to the Windows command shell, but not identical: many command names are different, Unix uses forward slashes (/) instead of back slashes (\) to separate elements of path names, and in Unix there's only one file hierarchy, rather than many file hierarchies, each rooted at a different drive letter (e.g. "C:"). Finally, in this lesson we revisit and amplify on the OS's role in managing user accounts and controlling access to the filesystem.
ronathat we all have accounts on. We can all use rona ... but what does "use" mean when you can't physically "have" the computer like you "have" your laptops? It means we can open a shell, execute commands, and create-view-edit files. The program
sshgives us a shell whose commands execute on rona, but display to and get keyboard input from our laptops. So, with ssh we can "use" rona from the comfort of our own laptop.
If your user name is
m16xxxx here's how you would
ssh command in a Windows command shell on
your laptop in order to open up a command shell whose commands
actually execute on rona:
ssh email@example.comSo, the command is
ssh, and the argument is
firstname.lastname@example.org, which is the username, "@" the name of the computer you want to login to. Of course you'll have to give your password before you're allowed on! A new shell window will pop up, and commands entered into this shell window execute on rona, not on your laptop.
Linux/Unix is already used to run the most advanced Fire Control and Sonar systems in the submarine fleet.
"Open Platform Version 2.1.1" is the operating system installed on your CAC. It has a filesystem, runs programs written in "JavaCard" (a subset of the Java programming language), and can run multiple processes at the same time.
Unix commands and the Unix shell should look pretty familiar, since you have experience with the Windows shell. The concepts of commands and arguments are basically the same, and you still have tab-completion and the up-arrow to retrieve previous commands. Ctrl-C kills an executing command, just like with the Windows command shell. However there are a few important differences that you need to understand to do much of anything.
fooare all different names in Unix.
copy name.txt myname.txtwould be written in Unix as
cp name.txt myname.txtwhich means the same thing, just uses the name
copy. Under course resources (the "r" button at the top of every page) there is a link to a short Windows/Unix Dictionary that you can refer to.
Administratorin Windows or user
rooton Unix), and a process owned by a privileged user can access files/directories they don't own. Administrator and root are super-users. A process owned by Administrator/root can access any file/directory.
net user foo bar /add ← create account for user foo with password bar \ \ \ `---- password |--- username / / net user foo /delete ← delete account for user fooIn Windows, you start an Administrator shell in order to give commands as the superuser. In Unix, you stick
sudoin front of the command. The system will ask you for a password, and if you give the right one, it will execute the command with owner
root. So, if the command
cat /home/wcbrown/examsolutions.txtfails with an "access denied" message, try
sudo cat /home/wcbrown/examsolutions.txtand, if you know the right password, it will succeed.