420 likes | 642 Views
Working on remote computers. by Pedro Henriques. June 1, 2012. Free Powerpoint Templates. Connecting to a remote computer. Clients. Servers. Internet. Connecting to a remote computer. Typical scenarios for remote access :. 1. Running analysis on a large cluster.
E N D
Working on remote computers by Pedro Henriques June 1, 2012 Free Powerpoint Templates
Connecting to a remotecomputer Clients Servers Internet
Connecting to a remotecomputer Typicalscenarios for remoteaccess: 1. Runninganalysison a large cluster 2. Checking in on a labcomputerfromhome
Connecting to a remotecomputer Runninganalysison a large cluster… Data Results Highcomputationalpower Lowcomputationalpower
Connecting to a remotecomputer Checking in on a labcomputerfromhome… Internet
Connecting to a remotecomputer Internet ProtocolAddress - IP 0 - 255 IPv4 232 uniqueaddresses IPv6 2128 uniqueaddresses
Connecting to a remotecomputer DNS server Web server 77.67.27.49 nature.com
Connecting to a remotecomputer “host” command myhost:~ lucy$ host www.nature.com www.nature.com hasaddress 77.67.27.49 myhost:~lucy$ host 134.89.10.74 74.10.89.134.in-addr.arpa domainnamepointer pismo.shore.mbari.org. “whois” command whois –h whois.arin.net 75.119.192.137 localhost - computeryou are loggedontothemoment (always127.0.0.1)
Connecting to a remotecomputer Security Nevergiveyour password to anyone (notevensystemadministrators) Don’tenableany network protocolsorservicesthataren’t essencial Makesurethatall software isup to date Use encryptedconnections (e.g. VPN) Avoidconnecting to servers over open network connectionswithoutencryption (e.g. publicWiFi)
Secure command-lineconnections “ssh” (securedshell) command Createsanencryptedconnectionbetweenyourclientcomputerandtheremote server Login Remotecomputer’saddress Password Username sshusername@address ********** (password) Acceptnewkey– allowsthetwocomputers to set up na encryptedcommunication
Secure command-lineconnections Remotecomputersmay use a differentshellthanbash echo $SHELL Same command-linetools (mkdir, cd, ls…)
Transfering files betweencomputers File archivingandcompression Sometimesit’seasyer to compressall files andsendthem as one… man zip …andif zip isnotavailable in theremoteconmputer “tar” command – creating a tarball myhost:~ lucy$ tar –cf ~/Desktop/scripts_31Mai2012.tar ~/scripts Oneor more entries, separatedbyspaces
Transfering files betweencomputers “gzip” command– file compression myhost:~ lucy$ gzip ~/Desktop/scripts_31Mai2012.tar Creates a .tar.gz smaller file and deletes theoldone “gunzip” command– file uncompression myhost:~ lucy$ cd ~/Desktop myhost:~ lucy$ gunzip scripts_31Mai2012.tar.gz myhost:~ lucy$ tar –xvf scripts_31Mai2012.tar Expandindicated file archieve
Transfering files betweencomputers “sftp” (securedfile transferprogram) command Transfer files over a sshconnection Move to thedirectory in thelocal machinewhereyouwant to sendorrecieve files myhost:~ lucy$ sftp lucy@practicalcomputing.org Connecting to pacticalcomputing.org... lucy@practicalcomputing.org’s password: ******** sftp> ls
Transfering files betweencomputers “scp” (secure remotecopy) command Move to theappropriate local directorybeforerunnungthecommand For downloading… scpuser@hostname:directory/remotefilelocalfile …anduploading scplocalfile.txt user@hostname:remotefile.txt
Full GUI controlof a remotecomputerwith VNC VNC – Virtual Network Computing Access to the complete graphicaluser interface (GUI) of a remotecomputer
Full GUI controlof a remotecomputerwith VNC Client Server Screensharing OS X Go OS X RemoteManagement Connect to Server Windows RealVNC Linux Available in the OS vnc://serveraddress
Troubleshootingremoteconnections Getting local with a Virtual PrivateNetwork (VPN) Elsewhere InstituteorUniversity Campus VPN (encrypted) Credentialverification
Troubleshootingremoteconnections Mapping network connections “traceroute” command Trace the network steps betweenyoursystemand na address tracerouteremoteaddress
Troubleshootingremoteconnections Configuringthebackspacekey Sometimesthebackspacekey can behavedifferenlybetweenmachines (^H) “stty” command sttyerase ‘^H’
Controlinghowprogramsrun On regular computers “sleep” command Does nothing for a specifiednumberofseconds, andthen stops host:~lucy$ sleep 15 ls • Anycommandtypedwhilesleepisrunningwillberunafteritquits
Controlinghowprogramsrun Terminating a process “^C” (ctrl + C)command Tries to terminate a programthatis active in thecommandline host:~lucy$ sleep 1000 Typing^Cwillendthesleepprogramandyouwillgetyourshellback
Controlinghowprogramsrun Starting jobs in the background “&” command Runs theprogram in thebackgroud, enablingthe use oftheshell host:~lucy$ sleep 15 & [1] 4990 host:~lucy$ sleepisrunning in the background as job number [1] andprocess ID 4990
Controlinghowprogramsrun Checking job status “ps” command Gives a snapshotofcurrent processes host:~lucy$ sleep 15 & [2] 4992 host:~lucy$ ps 4800 ttys001 0:00.02 –bash 4992 ttys001 0:00:00 sleep 15 Processidentifier (PID) ps -A Fulllistofeverythingyourcomputerisdoing
Controlinghowprogramsrun Checking job status “top” command Real-time viewofthesamelist as ps top –o command The–o modifierspecifiesbywhatparameteryouwant to sort
Controlinghowprogramsrun Suspending jobs andsendingthem to the background “^Z” (ctrl + Z)command Suspends na operationalreadyrunning host:~lucy$ sleep 15 ^Z [1]+ Stoppedsleep 15 host:~lucy$ ps PID TTY TIME CMD 5760 ttys001 0:00.02 –bash 5954 ttys001 0:00:00 sleep 15
Controlinghowprogramsrun Suspending jobs andsendingthem to the background “jobs”command Listsallthe background processes host:~lucy$ sleep 20 & [2] 5989 host:~lucy$ jobs [1]+ Stoppedsleep 15 [2]- Runningsleep20 & “bg”command Resumes a frozen job host:~lucy$ bg 1 [1]+ sleep 15 & [2] Donesleep20
Controlinghowprogramsrun Stopping processes When a processisrunning in the background, itwillbeimpervious to interruptionsbythe^Ccommand “kill”command Terminatesanyprocess (evenrunning in the background) host:~lucy$ sleep 60 & [1] 5563 host:~lucy$ ps PID TTY TIME CMD 5089 ttys000 0:00.06 –bash 5563 ttys000 0:00:00 sleep60 host:~lucy$ kill 5063 host:~lucy$ ps PID TTY TIME CMD 5089 ttys000 0:00.06 –bash [1]+ Terminatedsleep 60
Controlinghowprogramsrun Stopping processes Whenkilldoesn’twork… sudokill -9 5563 The-9parameterwill force theprogram to quit Thecombinedeffectwithsudoislethal
Controlinghowprogramsrun Keeping jobs alive Whenyouleavetheshell, all processes are terminatedwithit (eventheones in the background) “nohup” (nohang-up)command Indicatesthattheprogramshouldkeeprunningevenwhentheshellisterminated nohupphrapinfile.sff –new_ace > log.txt 2> /dev/null < /dev/null & Redirectsthe output file to log.txt Sendsany error messagens to animaginaryplacecalled/dev/nulll
Controlinghowprogramsrun Keeping jobs alive Thereisalso a way to modify a processafterithasstartedsothatitdoesn’tterminatewhentheshellcloses… Suspendtheprocesswith^Zcommand Sendit to thebackgroungusingbg 1 (orwhatever job isreported) Use thedisowncommand to releaseitfromtheshell disown -h It can stillterminatedue to output errors!
Controlinghowprogramsrun Changingprogrampriority “renice” command Adjuststhepriorityofeachprocess for processorpower host:~lucy$ ps PID TTY TIME CMD 29932 ttys000 0:00.01 –bash 29938 ttys000 0:00:06 traxm1HPC –b 13 -#100 ... host:~lucy$ renice 19 29938 Priorityrangingfrom -20 (highest) to 19 (lowest)
High-performanncecomputing Job management toolson clusters • It takes careofissueslikepriority management andshelltermination • Processes willbeterminatedifthey take too long • A configuration file withtheanalysisneeds to besent to the job manager
Settingup a server • Installand configure server software for thedeviceyouwant to provide (ssh, web server…) • Configure the firewall onthe server to allowaccess to theserviceyouwillprovide • Makesureyour local network allowsconnections to computersfromtheoutsideworld • Get na IP addressorhostnameofyour server sothatothercomputers can findit
Settingup a server Configuringthessh server Systempreferences Sharing pane Remole login (check)
Settingup a server Findingyouraddress echo $HOSTNAME host:~lucy$ host $HOSTNAME Mostlikellyyour IP addresswillchange (hours/days) Use thesystemnamereturnedby$HOSTNAME Request a fixed IP to your network administrator