OPS245 Lab 8 Newversion
The server concept
For most people a server is something on the internet you connect to, and a client is something you connect from. That sort of view is mostly valid, but it breaks down a little when the server and the workstation are the same machine.
A couple of examples:
- When you connect to wiki.littlesvr.ca in Firefox:
- Firefox is the client, it's making the request for a web page
- The web server (Apache) on wiki.littlesvr.ca is the server, responding the the request with the contents of the web page
- When you use your phone to check your email:
- The email application on your phone is the client, making the request to get new email
- The email server (e.g. Postfix, Gmail, Office365) is the server, responding to the request with a list of new emails
Most of a Linux system administrator's work is done in a terminal, and most of that is done on remote machines. Few companies can afford to hire in-house administrators, and those that can afford it have too many machines to connect keyboards and monitors to. But everything is connected to a network.
The same client-server model applies here. You connect from a terminal on your workstation to the machine you want to work with. In this case:
- The ssh program is the client, connecting to the ssh server, sends what you type to the server and prints the output which those commands print on the server.
- The ssh server (sshd) is the software on the destination machine which receives commands from the client, executes them, and sends the output of those commands back to the client.
Temporary account on ops345.ca
I've created an account for you on ops345.ca which you can use for SSH practice. Please don't abuse this account (i.e. don't upload 1GB videos to it).
You should have received an email like this:
Note that your username has an ops145_ prefix. Your password is randomly generated.
ssh to ops345.ca
You will be connecting to the ops345.ca server from your workstation using the ssh client.
The syntax for a basic ssh command is:
ssh usernameOnServer@serverAddress
The username is in your email. The server address is ops345.ca. After you run the ssh command: it will ask you for a password, which is the password in your email.
- Go ahead and use ssh to connect to ops345.ca as ops145_yourusername
The first time you ssh to a server: the ssh client will give you a scary warning message about authenticity. It's a very interesting message which is worth understanding, but we don't have time to talk about it in this course. Just enter "yes" in the prompt.
From this point on anything you type at the terminal will be sent to the server you're SSHed to, the commands you run will be executed on the server, and the standard output/error they produce will be sent back to your terminal.
You can notice that:
- Your prompt is different. This is usually the first hint that you are SSHed to another machine.
- Your username is different.
- None of your files are in your home directory.
- There appear to be almost no files on this system at all (look in / and /bin)
Your account allows you to SSH into a chroot, which is another thing we don't have time to talk about.
- You can end your session by running "exit"
- Reconnect to ops345.ca and create a directory named lab8 inside your home directory.
- On the server there is an /srv/art/ directory, with some ASCII art in text files. Copy that art directory and its contents into the lab8 directory you just created.
- Change the permissions on the art directory to 700 so that noone else can read its contents.
- You may look in other students' home directories under /home - the default permissions will allow you to do this. That's somewhat of a tradition from the old days.
- If you like: change the permissions on your home directory so that other users cannot see what's in it.
Also
- Create an account on ops345.ca for ssh practice
- The "server" concept
- Using ssh to control a remote Linux server
- Remote credentials don't need to match local credentials
- Permissions work the same way, they apply to the user who is logged in
- Practice with permissions on files you own and files you don't own
- Copy files between Linux machines using scp
- Copy directories
- Note how ownership applies to files transferred between systems