Home > ssh > Simple ssh examples for Ubuntu

Simple ssh examples for Ubuntu

February 22Hits:1

I would like to use ssh to access the shell of another Ubuntu computer and issue a few commands. I'm interested in how to form the shh command in the following scenarios. To keep it simple, I will not be using password protected accounts. I would like to focus primarily on command formations that establish the connection.

  • Two local Ubuntu computers directly connected with an Ethernet cable:
  • Two remote Ubuntu computers where each is connected via cable modem (each has it's own ip):
  • Same as previous, but one is using NAT:
  • Two remote Ubuntu computers, where one is connected via a cable modem and the other is connected via a wireless router:
  • Two local boxes connected to the same wireless router:


With local Ubuntu boxes, whether they're connected directly or using a switch, you can use hostname.local to connect. So, if your laptop is called bambuntulaptop, then you can connect to it using bambuntulaptop.local.

For non-local connections, you'll have to use an IP address or setup a dns server. You can use ddclient coupled with a service like dyndns.org.

NAT isn't really relevant with regards to ssh. You'll need to forward port 22 to the right machine, or configure your ssh server to use another port and forward that one. Port 22 is the default ssh port.

You must not allow non-protected accounts. There are thousands, or hundreds of thousands of computers who are scanning for things to abuse. Allowing any user on the internet to run programs on your computer is a seriously bad idea. Ubuntu is secure, but not that secure. In fact, I don't think you will be allowed to use non-password protected accounts with ssh. If you wanted to do that, then you'd need to setup keys. That would be another question.

The command to establish the connection itself, could hardly be any easier: ssh [email protected]. In other words, reusing the example from above; ssh [email protected].

ssh works the same way across all these scenarios. The network configuration is not important. ( OK You may have to set up port mapping to go across a NAT ).

At it's simplest you run

ssh {host}

Not using passwords doesn't make it simpler, because you will have to set up keys, which is slightly more complicated.

Setting up ssh is simple to do, just install openssh-server and openssh-client and then connect using ssh {host}

Tags:ssh, remote

Related Articles

  • Simple ssh examples for UbuntuFebruary 22

    I would like to use ssh to access the shell of another Ubuntu computer and issue a few commands. I'm interested in how to form the shh command in the following scenarios. To keep it simple, I will not be using password protected accounts. I would lik

  • Setting up ssh server on Ubuntu dektopApril 24

    I'm setting up a ssh server on 10.10(soon to be 11.04) desktop. I'm sure this goes without saying but, I want it to be as simple and secure as possible. I only plan to connect from one other Ubuntu machine. I have a few starter questions - ssh-keygen

  • How to ssh my desktop(ubuntu) from outside network May 11

    This question already has an answer here: Installed SSH on Ubuntu computer, can't connect from computer over internet 4 answers I have set up simple ssh server by using openssh on my Ubuntu. I tried to ssh it from my Mac, which successful. But my mac

  • What does "System Load" represent when SSH into an ubuntu server?March 21

    When I SSH into my ubuntu server the following message is displayed: System load: 12.44 Processes: 131 Usage of /: 13.5% of 58.93GB Users logged in: 1 Memory usage: 55% IP address for eth0: Swap usage: 0% What does a system load of 12.4

  • How do I ssh into my Ubuntu VM when my Mac is on a VPN?December 11

    I can ssh into my Ubuntu VM (running in VMware Fusion) when I'm not on my employer's VPN. (It works both when the VM's network connection is NAT and bridged.) But when I connect to the VPN, I can no longer ssh into my VM: $ ssh ssh: co

  • How to host a ssh server in ubuntu?October 27

    I have installed ubuntu as my guest Os using vmware as a virtual machine. I want to host a ssh server in my virtual machine(Ubuntu) and access it via ssh client in my windows. First of all , how to start a ssh server in ubuntu ? And how to achieve th

  • Moving SSH keys from UbuntuMay 26

    I have set up SSH keys on my Ubuntu machine (10.04) and now I am moving to Debian. On the Debian machine, do I generate new SSH keys corresponding to my username or is it possible to (and is OK) if I copy the ~/.ssh folder from Ubuntu and place it in

  • SSH tunnel in UbuntuDecember 16

    How do I create a ssh tunnel in Ubuntu that is persistent? I have tried a lot of ways but I haven't gotten it to work. --------------Solutions------------- apt-get install autossh, then use autossh instead of ssh in the tunnel creation command line.

  • Why isn't cluster-SSH working on Ubuntu Server?September 10

    I have installed cluster-SSH on my ubuntu 10.04 server, it has a dependency of xterm_261-1_amd64. when i try to $cssh localhost it says [email protected]:~$ cssh localhost connect /tmp/.X11-unix/X0: No such file or directory and when i try to open x

  • When I ssh into a ubuntu machine, what kind of shell am I usingSeptember 26

    I keep reading about interactive, non-interactive, login, and non-login shells. (This is in the context of which of the .bash* files is read). I don't understand what each type of shell is, so let's start with the basics. If I ssh from my mac to my u

  • How can I ssh mount an Ubuntu server's filesystem?October 8

    I posted this question on Stack Overflow, and the one response mentioned, "I guess from your mention of opendiff that you're using Mac OS. The recommended way to get sshfs on Mac OS used to be macfuse, but it looks as if that is no longer supported,

  • Allowing multiple users SSH access to Ubuntu instance running on Amazon Web ServicesJanuary 16

    It seems as if similar questions have been asked before, but the issue that I am having hasn't been raised or answered as a part of the answers provided to the other questions. So... I'm using an Amazon EC2 instance that is running Ubuntu, and I've a

  • Web proxy with SSH Tunnel to Ubuntu 12.04 with Putty is refusing connectionsApril 10

    I'm trying to set up a SSH tunnel via Putty so I can access my router admin pages. I have an ubuntu 12.04 machine on the local network with SSH access. I can SSH into that ubuntu box (that sits on the same network as the router i'm trying to get to).

  • Simple architectural software for Ubuntu

    Simple architectural software for UbuntuApril 19

    I have tried to find a simple architectural software for Ubuntu. I need something that can draw walls in different materials that has fixtures that can be dropped in to the drawing. A friend lent me Home Designer by Chief Architect. It only works on

  • Why cant I ssh into my ubuntu server? (ssh_exchange_identification error) June 4

    This question already has an answer here: SSH Error: unknown key type '-----BEGIN' 4 answers I am trying to ssh into my ubuntu server (which I have done many times before) and I get the error: ssh_exchange_identification: Connection closed by remote

  • ssh-agent on ubuntu rapidly restartsJune 11

    I am attempting to use ssh-agent on Ubuntu 13.10 so that I will not have to enter my passphrase to unlock a key every time I want to use ssh or git. As you can see below, ssh-agent appears to be restarting for some reason. These commends were execute

  • SSH Server on Ubuntu not worksAugust 6

    I wanted to start SSH server on Ubuntu 14.04 running on VirtualBox. I installed Openssh, sshd, etc., configured sshd_config to listen on ip, which I see in ifconfig and it not working. I'm starting sshd on port 2222. nmap gives: PORT STATE SERVICE 80

  • Is there a simple HowTo for getting Ubuntu and a browser working on an old PC?October 1

    I have a 2007-vintage Dell PC, formerly running WinXP. Is there a simple HowTo for getting Ubuntu and a browser working on it? FWIW, the PC is a Dell Latitude D620, it shows only 1 GB of main memory in the Windows Task Manager. WIth the demise of XP

  • Not able to ssh localhost in ubuntu 14.04August 26

    Not able to ssh localhost in ubuntu 14.04. Tried with ip also : [email protected]:~/chef-repo/.chef$ ssh [email protected] Permission denied (publickey). [email protected]:~/chef-repo/.chef$ ssh [email protected] Permission denied (publickey). [email protected]

  • Cannot SSH into VirtualBox Ubuntu VM using PuttySeptember 22

    I'm running Windows 7 and have Ubuntu VirtualBox installed. I'm trying to ssh into Ubuntu from my Windows using Putty. I failed. I have tried the following: I see that OpenSSH server is running and listening on port 22. I tried SSH localhost from Ubu

Copyright (C) 2017 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.406 s.