SSH (Secure Shell)

Check your ip address

macOS

ifconfig | grep inet

Linux

hostname -I

SSH Operations

Installing OpenSSH server

sudo apt install openssh-server

Connecting to a remote server

ssh username@hostname

Copying files to/from a remote server

scp username@hostname:/path/to/remote/file /path/to/local/file
scp /path/to/local/file username@hostname:/path/to/remote/file

Setting up passwordless SSH

  1. Generate a new SSH key pair:
ssh-keygen -t rsa -b 4096 -C "a comment"
  1. Copy the public key to the remote server:
ssh-copy-id -i <identity_file >username@hostname
  1. Modify the ~/.ssh/config file:
Host hostname
User username
HostName hostname
IdentityFile ~/.ssh/identity_file

Now you can log in without a password:

ssh username@hostname
Created by Ryan D. Najac for the Palomero Lab at the Institute for Cancer Genetics.
Page last updated on 2025-04-17.