On Mac

Enable remote login

sudo systemsetup -setremotelogin on

confirm your system username

whoami

Confirm your local area network address. This can be obtained from

Apple menu => System Preferences => Networking

or from the terminal by inspecting the output of ifconfig command. This command produces tons of output so try filtering it with ifconfig | grep inet

Now you can connect to your Mac from another system on your local network.

ssh <system_username>@<system_local_ip>
# for example: ssh sammyjones@192.168.5.40

Once you enter the password you will have full system access. (yikes)

to disable:

sudo systemsetup -setremotelogin off

On Ubuntu/Linux

Similar workflow. To start an ssh server, run this command

sudo apt-get install openssh-server

Using the same ssh user@ip_address syntax you can now log into your Linux system.