Загрузка страницы

Simple SSH Setup for Ubuntu and Linux Mint

Simple SSH Setup for Ubuntu and Linux Mint:

Most Linux distributions come with the SSH client already installed. If you want to use SSH to log into a remote machine, you will have to install the server application on that machine and make sure it's up and running.

SSH Server Setup:

Your router may not be running a local host name server. Most modern routers don't. In that case, The SSH server machine should be set with a static IP address on the local network. You should do this first before installing the server software.

You will need to know the gateway address, netmask, available IP addresses for your local network and DNS server addresses.

To find your gateway address:

ip route

The gateway is the address of your router. It should be something like 192.168.0.1.

To find you current IP address and netmask:

ifconfig

(If ifconfig is not already installed run: sudo apt install net-tools)

Your current IP4 address is prefaced with 'inet' and the netmask is listed right after it. Ex. "inet 192.168.0.11 netmask 255.255.255.0 broadcast 192.168.0.255"

You will need to set addresses for Domain Name System servers so your system can find web sites. This is usually done automatically through DHCP but we will do it manually. You can get DNS from your ISP or use an open DNS. I prefer 1.1.1.1 and 1.0.0.1. To learn more: https://www.cloudflare.com/learning/dns/what-is-1.1.1.1/

Reboot and confirm the new static IP is working properly.

Install SSH server:

sudo apt install openssh-server

Once installed, the server should automatically start itself and the machine will be waiting for logins from other machines on the network through port 22. Be sure to allow traffic on port 22 through any firewalls.

First Login:

ssh 192.168.0.20

You must type in "yes" and provide the password for the account you're logging into on the remote machine.

Use SFTP:

sftp 192.168.0.20

SFTP works very much like FTP but uses a secure SSH connection.

To make login a little easier use this script or set the command as an alias:

#!/bin/bash

# SSH login shorthand command: "sshin (last two digits of IP)"

ssh -X 192.168.0."$1"

The -X option turns on X forwarding.

Use SSH Keys:

Keys make for grater security and automate login. There are many options and ways to work with SSH keys. This is a very simplified way to get started with SSH keys.

Generate keys on cleat machine:

ssh-keygen

Accept the default file name and path. For passphrase, just press enter.

Confirm key creation with:

ll .ssh

Copy public key to server:

ssh-copy-id joe@192.168.0.20

You may now login automatically. You might consider turning off password access to the server to make it more secure. Don't copy you personal ssh key (id_rsa) to the server unless you intend to log into other machines on your local network from that machine. You should never put your private key on servers running on the public internet.

Use SSHFS:

To take advantage of secure file sharing through SSH, you'll need to have the SSHFS client installed on the client machines. Install it on the server if that machine will also be an ssh client

sudo apt install sshfs

Access files on remote machines:

sshfs (user@)host:(dir) mountpoint (options)

Ex. sshfs 192.168.0.20:Documents/ Shared-Documents/ -o reconnect

Add a command like this to your startup applications or put several in a script to setup secure file sharing automatically.

Check out https://www.ezeelinux.com for more about Linux.
Please join the discussion at EzeeTalk.
https://www.ezeelinux.com/talk/ It's free, secure and fun!

Видео Simple SSH Setup for Ubuntu and Linux Mint канала Joe Collins
Показать
Комментарии отсутствуют
Введите заголовок:

Введите адрес ссылки:

Введите адрес видео с YouTube:

Зарегистрируйтесь или войдите с
Информация о видео
29 июля 2019 г. 22:20:48
00:51:23
Яндекс.Метрика