Code University

      "Where tuition is free!"

News | Images | Contact     
  • Home
  • Coding KC
  • Scripts
  • Software
  • Templates
  • Tutorials
  • About
 

Coding Knowledge Center

SSH/SCP/SFTP


Page Contents
[X] CLOSE

Setup SSH

  • Setup SSH (1. ssh-keygen - dsa)
  • Setup SSH (2. dir structure)
  • Setup SSH (3. authorized_keys file)
  • Setup SSH (4. Organize keys)

scp

  • scp (Copy dirs/files)

sftp

  • sftp (Copy dirs/files)

ssh

  • ssh (Connect)
  • ssh (Diff)
  • ssh (Tunnel)
Toggle Page Contents
Setup SSH (1. ssh-keygen - dsa)Copy  To New Window  Top ^
1) ssh-keygen -t dsa 2) ssh-keygen -t rsa
1) Creates dsa encrypted keys. Creates ~/.ssh/id_dsa (private key). Creates ~/.ssh/id_dsa.pub (public key). 2) Creates rsa encrypted keys. Creates ~/.ssh/id_rsa (private key). Creates ~/.ssh/id_rsa.pub (public key).



Setup SSH (2. dir structure)Copy  To New Window  Top ^
~/.ssh authorized keys: list of public keys which will be granted access and require no login password id_dsa: private dsa encypted key id_dsa.pub: public dsa encrypted key id_rsa: private rsa encrypted key id_rsa.pub: public rsa encyrpted key known_hosts: list of known host keys the current user has previously secure shelled to
Typical secure shell home directory file contents.



Setup SSH (3. authorized_keys file)Copy  To New Window  Top ^
cat id_dsa.pub >> $HOME/.ssh/authorized_keys
Put your public key in this file on the remote server so it will no longer prompt for password. CAVEAT: make sure the entire key is all on one line! The best way to do this is to copy id_[dsa/rsa].pub to the remote server and then type the above line.



Setup SSH (4. Organize keys)Copy  To New Window  Top ^
~/.ssh/ site1/ id_dsa id_dsa.pub id_rsa id_rsa.pub site2/ id_dsa id_dsa.pub id_rsa id_rsa.pub > ssh -i ~/.ssh/site1 user@site1.com > ssh -i ~/.ssh/site2 user@site2.com
TIP! You can actually organize your keys in various sub directories and then specify which set to use when using ssh. Use the -i option to tell ssh where to access the keys that are to be used.



scp (Copy dirs/files)Copy  To New Window  Top ^
scp [dir/file] [hostname]:[dir/file] scp [dir/file] [user]@[hostname]:[dir/file]
Secure copy [dir/file] to [hostname] as [dir/file]. Secure copy [dir/file] as [user] to [hostname] as [dir/file].



sftp (Copy dirs/files)Copy  To New Window  Top ^
1) sftp [dir/file] [login]@[hostname]:[dir/file] 2) sftp -b [input file] [login]@[hostname]
1) Secure ftp [dir/file] to [hostname] as [dir/file]. 2) Secure ftp in batch mode using commands in input file.



ssh (Connect)Copy  To New Window  Top ^
ssh [login]@[hostname] ssh -l [login] [hostname]
Secure shell as [login] to [hostname].



ssh (Diff)Copy  To New Window  Top ^
ssh remotehost "cat remote_file" | diff - "local_file"
Connect to a remote host and perform a diff between a remote and local file.



ssh (Tunnel)Copy  To New Window  Top ^
ssh -L 9001:localhost:21 steved@blackbox > ftp localhost 9001
Port forward an ssh connection to port 9001. Ftp through encrypted port 9001.
Technologies
  • Introduction
  • Awk
  • Bash
  • Cron
  • CSH
  • CSS
  • CVS
  • FTP
  • FTPS
  • HTML
  • JavaScript
  • KSH
  • Linux
  • Linux (Debian)
  • Linux (LPIC 101-102)
  • Linux/Unix
  • Mac OS X
  • MySQL
  • Oracle
  • Perl
  • PGP
  • PHP
  • Sed
  • SQLite
  • SSH/SCP/SFTP
  • Telnet
  • UNIX
  • Windows
Resources
  • CodeIgniter - MVC Framework
  • HowtoForge - Linux Tutorials
  • Linux Today - Linux News
  • Lxer - Linux News Feed
  • Monsterb - Linux, Podcasting
  • MySQL - Databasing
  • Perl - Programming
  • PHP - Programming
  • Systhread - Admin & Programming
  • W3Schools - Web Tutorials
About

Code University contains a wealth of technical information aimed at the computer sciences.


 
Home | Coding KC | Scripts | Software | Templates | Tutorials | About
Top ^
 
© 2007-2012 Code University| Disclaimer
Website template by Arcsin