Using SSH in Linux

3.18.19 SSH
Created Thursday 14 March 2019
Net Control – KA7PLE

• SSH
◦ What is ssh
▪ Secure Shell
• Requires an ssh client and server (local and remote)
◦ can be on local network or across the world.
• Standard port is 22
• There is a way to change the default ssh port
◦ See the link below
◦ Why run ssh
▪ To securly access files, applications, or control or administer a remote computer
▪ For example running a Raspberri Pi in headless mode. You can access it via ssh or ssh -X if you are using a distro with the X server (GUI interface) running on it.
◦ ssh configuration files
▪ are located in /etc/ssh
▪ ssh_config file is where all the magic happens
▪ /usr/bin/ssh is where the actual executible lives.
◦ Basics
▪ Downloading SSH Server on target machine
• Some distro’s may have openssh server already installed.
• On Debian based systems, install ssh with; sudo apt install openssh-server
• Ther are other ssh options but openssh is one of the most popular and very widely used.
▪ Basic commands
• ssh username@host ip address <hostname@domain.name>
◦ You will need an account on the remote system you wish to access
◦ Will make connection and ask for passowrd
• ssh -X username@host ip address <hostname@domain.name>
◦ You will be able to start xsession applications that display back to the local system
▪ The application will be running on the target machine, but displaying on the local machine
• There is a web ssh, but I have never used it before.
◦ it allows you to use your browser to access a remote computer via ssh.
◦ It is a graphical interface or a command line via browser.
▪ depending on how the remote computer is setup.
▪ Moving files from one system to another through ssh
• command: scp
◦ scp /localdirectory/example1.txt <username>@<remote>:<path> will copy example1.txt to the specified <path> on the remote computer. You can leave <path> blank to copy to the root folder of the remote computer.
◦ scp <username>@<remote>:/home/example1.txt ./ will move example1.txt from the home directory on the remote computer to the current directory on the local computer.
▪ Off course all regular commands, cd, ls, df, Etc will work
▪ Creating an ssh key
• allows you to access a remote computer with out having to enter a password.
◦ after the first time connecting 😉
• create the key
• scp the key to the remote computer
• install the key on the remote computer
• Viola! no more password prompt when you ssh to that remote computer
• You will need permission form the remote system administrator to install the key on the system.
• For more details search for creating an ssh key on the interwebs.
▪ Tmux is a great tool to access jobs running on a remote computer (Command line interface only)
• Working from home and checking on a job running on a remote computer
◦ start tmux on the remote computer and start the job in a tmux session.
◦ You can then detatch from the tmux session. It will continue to run in the background Along with what ever job you started.
• ssh into the remote computer and attach to the tmux session running the job you wish to check on it.
▪ remote control of your ham station
• using ssh (-X) to start the software controlling the radio
• Displays back to the local computer with full control
◦ Warning, a good stable internet connection is required to maintain control of the software and radio
▪ MESH networking
• All of the above will work work through an Amateur Radio MESH network.
• Once the network is connected, if you have an account on the target (remote)computer, you can ssh into it and do everything that you are allowed to do with in the permissions of the account permissions on the remote computer.
▪ Permissions on the remote computer
• most disro’s wont allow guest accounts
• the Admin of the system will have to set up an account for you. Will most likely be very limited, and have pretty tight restrictions as to what you are able to do.
• If it’s your own computer, you will have what ever permissions you setup for your own account.
◦ Accessing a Windows or maOS system via ssh.
▪ You must install an ssh server/client on windows.
• diferent versions for Windows 7 vs windows 10
▪ Again, you need an account on the remote system
▪ Your permissions will be set by that account.
▪ You can run applications, administer Etc a Windows system from a Linux.
◦ Other cool things you can do with ssh
▪ Mount a remote filesystem via ssh
▪ ssh tunneling
• allows you to encrypt your data stream and keeps people on your local wifi/network from accessing your data
• The data will unencrypted once it hit the interntet.
▪ Link in the discription
• Questions, Comments, links
◦ https://www.wikihow.com/Use-SSH
◦ https://en.wikipedia.org/wiki/Secure_Shell
◦ https://linuxize.com/post/how-to-change-ssh-port-in-linux/
◦ https://www.howtogeek.com/114812/5-cool-things-you-can-do-with-an-ssh-server/
◦ https://www.howtogeek.com/311287/how-to-connect-to-an-ssh-server-from-windows-macos-or-linux/
◦ https://kc7mm.com/wiki/doku.php
◦ http://kc7nyr.com/links/
◦ linuxusernet@kc7nyr.com


This Site is Updated Often. Thank you for The Visit!
Copyright © 2018-2019 KC7NYR Amateur Radio Site

Site Map

168total visits,2visits today