remote access and ssh
play

Remote Access and SSH a t t e n t i i g r e e n ! P a y t o t e x t - PowerPoint PPT Presentation

Remote Access and SSH a t t e n t i i g r e e n ! P a y t o t e x t o n n T h e s e c o r r e c t i d o n e a f t h e l e c t u r e ! t e r a r e o n s 1 Remote Access Modern computing requires the use of a variety of resources located on


  1. Remote Access and SSH a t t e n t i i g r e e n ! P a y t o t e x t o n n T h e s e c o r r e c t i d o n e a f t h e l e c t u r e ! t e r a r e o n s 1

  2. Remote Access ● Modern computing requires the use of a variety of resources located on different machines in widely separated locations. ● You are familiar with the world wide web, which allows us to obtain information from other machines. ● However, mathematicians frequently need to create and delete files on other machines, or even to use their processing power. 2

  3. SSH ● Secure Shell (SSH) is a cryptographic network protocol to run a command line on a remote machine. ● Client-server architecture : the "ssh client" runs on your local machine, while the remote machine must run an "ssh daemon" - a server. ● There are two ssh protocols: ssh1 , which uses 56-bit encryption (this means that the public keys can be expressed in 56 binary digits) and is susceptible to some attacks, and ssh2 , which uses 128-bit encryption and is much safer. 3

  4. Command-line Interface ● A command-line user interface (CLI) , also known as a console user interface is a means of interacting with a computer program where the user (or client) issues commands to the program in the form of successive lines of text (command lines). A program which handles the interface is called a c ommand language interpreter or shell . ● Implemented by cmd.exe in Windows, Terminal in Linux/MacOS. ● SSH provides access to CLI on a remote machine. ● Graphical User Interfaces (GUI - pronounced "gooey") are the familiar ways that we interact with computers. Before Xerox invented the GUI in the 1970s, command lines provided the only interfaces to computers. Since the mid-eighties, GUIs have become the only interfaces to computers that most people know. 4

  5. SSH Clients ● There is a bunch of them. Here are the most popular. ● PuTTY (Windows). Free and open-source. Has a handy GUI. ● OpenSSH (Linux). ● MacOS has a built-in ssh client. ● On Linux/MacOS typically the command looks like ssh username@remote.host.name[:port] . 5

  6. Processes ● Processes are the tasks that a computer handles. Every time you run any command, it appears on the computer as a process, with attributes and identifiers. If a process runs amok, you need to do something about it. Thus, commands for managing processes are integral to any good operating system. ● In most modern operating systems there may be lots of processes running at the same time. This is referred as multitasking . ● Process has its owner associated with it (a user which started this process). The process has the same permissions as its owner does . ● Each process has it’s own dedicated piece of memory. You may think of it as a sandbox where the code of your particular program/task is executed. 6

  7. Managing Processes ● Commands for managing processes are integral to any good operating system. ● In Windows it’s Task Manager (taskmgr.exe). Could be reached by pressing Ctrl+Esc or Ctrl+Alt+Del and mostly used to kill application that is hanging. ● Starting a process from the command line is the easiest thing to do on any computer. Just type the name of the process you want to run. ● For example, on a Unix computer the command /usr/bin/firefox should run the Firefox Browser. ● On windows, the corresponding command would be "c:\program files\firefox\firefox.exe". ● In addition you can specify command options/arguments/parameters which define the way command should behave. Each command has it’s own predefined list of parameters which make sense specifically for this command. To see the exhaustive list all options for standard commands use man <command_name> command. For example man ls will give you information about ls command. 7

  8. Foreground and Background Execution ● By default , every process that you start runs in the foreground . It gets its input from the keyboard and sends its output to the screen. ● If the ls command wants any input (which it does not), it waits for it from the keyboard . While a program is running in the foreground and is time-consuming, no other commands can be run (start any other processes) because the prompt would not be available until the program finishes processing and comes out. ● A background process runs without being connected to your terminal. If the background process requires any keyboard input, it waits but you couldn’t see this. ● Th e advantage of running a process in the background is that you can run other commands; you do not have to wait until it completes to start another. ● The simplest way to start a background process is to add an ampersand (&) at the end of the command. ● So typing e.g. /usr/bin/firefox will start Firefox Browser in foreground, whereas /usr/bin/firefox & will run Firefox Browser in background. 8

  9. Managing Processes: ps command. ● In Linux the basic command for monitoring processes is called ps (process status). Typing ps by itself lists the processes that you own from your current session on the computer. ● Here is the most important information you can get from ps command output. ● User – owner of the process ● PID – unique ID of the process ● TTY – t erminal associated with the process ● STIME – process start time ● TIME – CPU time taken by the process ● CMD – The command that started this process 9

  10. Managing Processes: ps command. ● ps -f gives you some more details ● ps -x – shows information about processes without terminals ● ps -a shows processes for all users ● ps -u shows the process's user/owner ● You can get more by running man ps 10

  11. Interrupting Process ● The easiest way to kill a process that has taken over your command line is to press <ctrl>+c . The "control-c" combination interrupts almost any process that is running in your shell as a foreground process . ● To kill process which is running in background use kill command. You will need PID for that which you can find with ps command. ● kill -9 1245 will kill process with PID 1245 . 11

  12. Filtering Output of ps command ● Use ps [your options] | grep <expression> . We’ll discuss more details about grep later. ● Use wildcards for specifying <expression> ● There are a few "wildcard" characters that can match many things. The question mark matches any single character . Thus, ls image?.jpg would list all of the files image1.jpg, image9.jpg, and imageA.jpg on a directory, but would not list image23.jpg The asterisk matches any number of characters , so that ls image*.jpg would list image1.jpg, image23.jpg and image49027.jpg. 12

  13. More on Processes ● Parent and Child Processes : each unix process has two ID numbers assigned to it: The Process ID (pid) and the Parent process ID (ppid). Each user process in the system has a parent process. Most of the commands that you run have the shell as their parent. Check the ps -f example where this command listed both the process ID and the parent process ID. ● Zombie and Orphan Processes : normally, when a child process is killed, the parent process is updated via a SIGCHLD signal. Then the parent can do some other task or restart a new child as needed. However, sometimes the parent process is killed before its child is killed. In this case, the "parent of all processes," the init process, becomes the new PPID (parent process ID). In some cases, these processes are called orphan processes. ● When a process is killed, a ps listing may still show the process with a Z state. This is a zombie or defunct process. The process is dead and not being used. These processes are different from the orphan processes. They have completed execution but still find an entry in the process table. ● Daemon Processes: daemons are system-related background processes that often run with the permissions of root and services requests from other processes. A daemon has no controlling terminal. If you do a "ps -ef" and look at the tty field, all daemons will have a ? for the tty. ● To be precise, a daemon is a process that runs in the background, usually waiting for something to happen that it is capable of working with . For example, a printer daemon waiting for print commands or SSH daemon you are actually interacting with to connect to this machine through SSH. ● If you have a program that calls for lengthy processing , then it’s worth to make it a daemon and run it in the background. 13

  14. Navigation and File Management ● Another fundamental skills you need to master are moving around the filesystem and getting an idea of what is around you. We will discuss the tools that allow you to do this. ● You also probably will need to change what’s around you. Here is where file management commands come in handy. 14

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend