Dr. Mark Humphrys

School of Computing. Dublin City University.

Online coding site: Ancient Brain

 

Search:


ssh

ssh is the normal way of getting command-line access to a Linux/Unix system.

Windows ssh client: PuTTY




How to set up ssh keys

An ssh key is a key kept as a file on your computer, that must match another key on the server.
The key is huge (like around 1600 characters) so unlike a password cannot be guessed by bots.
If you use ssh keys to login to Linux, you do not need a password.
  1. Login to Linux
  2. Setup a .ssh directory if it does not exist
     mkdir ~/.ssh 
  3. Generate keypair using ssh-keygen
     cd ~/.ssh
     ssh-keygen 
    
    Hit enter to accept default filename.
    Hit enter to skip passphrase.

  4. Result is private and public key files:
    • id_rsa
    • id_rsa.pub

  5. Append public key to authorized_keys:
     cat id_rsa.pub >> authorized_keys 
  6. Hide authorized_keys:
    chmod go-rwx ~/.ssh 
    chmod go-rwx ~/.ssh/authorized_keys 
    
    This is important. Clients may generate cryptic errors if authorized_keys is not hidden.

  7. Copy private key to your PC. There could be various ways of doing this.

  8. To use private key with PuTTY:

  9. Now you have a private key on your PC, you tell your ssh and sftp clients to use this private key instead of a password. You need to tell it username.
  10. You will find it logs you in with no password.


  


sftp

sftp or similar is the normal way of getting remote read-write file system access to Linux/Unix systems.
  

How to turn an sftp site into a drive

If you have a Windows client and a Linux server, you can use sftp to turn the Linux server into a drive on Windows, like the X: drive.
  

sftp likes a silent shell


  
ancientbrain.com      w2mind.org      humphrysfamilytree.com

On the Internet since 1987.      New 250 G VPS server.

Note: Links on this site to user-generated content like Wikipedia are highlighted in red as possibly unreliable. My view is that such links are highly useful but flawed.