• Stars
    star
    187
  • Rank 199,936 (Top 5 %)
  • Language
    Shell
  • License
    Apache License 2.0
  • Created over 8 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Script to automate the setup of ssh-public/private-key authentication to avoid some common pitfalls

What

This is a small script to perform all the tasks that are necessary to create a private/public keypair for ssh-authentication for password-less connecting to a remote server. Additionally it performs some checks and adjusts file-permissions both locally and on the remote server to avoid some common pitfalls.

Why

Because I failed every time I tried to do this manually.

How

Preconditions

You need to be able to connect to the remote server with ssh and a username and password.

Grab it

git clone https://github.com/centic9/generate-and-send-ssh-key.git

Run it

The script expects some commandline arguments which specify which key should be transferred/created and where it should be sent to:

-u (--user) <username>, default: $USER
-f (--file) <file>,     default: ~/.ssh/id_test
-h (--host) <hostname>, default: host
 
-p (--port)    <port>, default: <default ssh port>
-k (--keysize) <size>, default: 2048
-t (--keytype) <type>, default: rsa

-P(--passphrase) <key-passphrase>, default: <empty>

You should at least set --user, --file, and --host.

cd generate-and-send-ssh-key
./generate-and-send-ssh-key.sh --user bob --host myhost

This will ask for the password of the target host at least once, probably twice, if the permissions are not set correctly yet.

If the key-file does not exist yet, a new key will be generated.

Enjoy

Now you should be able to connect to the machine via ssh -i $FILENAME $USER@$HOST.
If you use the filename ~/.ssh/id_rsa you can omit the "-i" argument to ssh.

Support this project

If you find this tool useful and would like to support it, you can Sponsor the author

Caveat

This script will remove write access to your home-directory for "group" and "other" on the remote server because ssh-public/private key authentication will not work otherwise.

So if there are processes running as different user, writing data to this directory may fail for them after this script is run.

Related documents

Licensing

Copyright 2015-2022 Dominik Stadler

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

More Repositories

1

jgit-cookbook

Provides examples and code snippets for the JGit Java Git implementation
Java
1,713
star
2

poi-on-android

A sample project that shows how Apache POI can be used in an Android application
Java
321
star
3

headset-charge-indicator

A simple app-indicator for GNOME desktops to display the battery charge of some wireless headsets which also allows to control some functions like LEDs, sidetone and others.
Python
117
star
4

CommonCrawlDocumentDownload

A small tool which uses the CommonCrawl URL Index to download documents with certain file types or mime-types. This is used for mass-testing of frameworks like Apache POI and Apache Tika
Java
58
star
5

IntelliJ-Action-IDs

Create and publish a list of available ActionIDs for the IntelliJ plugin system by recursively searching through the jar-files and producing HTML via Jekyll
Java
32
star
6

poi-mail-merge

Small application which allows to repeatedely replace markers in a Microsoft Word document with items taken from a CSV/Microsoft Excel file to provide a simple mail-merge functionality
Java
31
star
7

JGitFS

JGitFS provides access to Git branches/tags/commits like they are separate directories via a Linux FUSE userland filesystem
Java
28
star
8

commons-dost

Utilitity library for stuff that I use in multiple projects
Java
6
star
9

actions

Repository of reusable Github workflows
4
star
10

commons-audio

A small library of code-pieces that I find useful when developing tools and applications around handling of audio, playing sound, downloading audio from certain websites
Java
4
star
11

poi-fuzz

Use Jazzer to perform fuzzy testing of Apache POI
Java
3
star
12

github-version-statistics

Uses the GitHub API to search for usages of a Java library and prepares some statistics about which versions are used how often
Java
3
star
13

cli-fuzz

Use Jazzer to perform fuzzy testing of Apache Commons CLI
Java
3
star
14

openambit-ppa

Openambit sources with Debian/Ubuntu packaging for PPA created using git-buildpackage
C
2
star
15

config

Helper project which stores some config-files that I would like to have on every machine that I work on
Shell
2
star
16

unoconv-ppa

unoconv sources with Debian/Ubuntu packaging for PPA created using git-buildpackage
Python
2
star
17

IntelliJ-Automation-Plugin

Plugin for IntelliJ IDE which provides a REST interface to automatically trigger actions in a running instance of IntelliJ IDE
Java
2
star
18

demo-fuzz

Minimal application for fuzzy-testing of Java code via the Jazzer fuzzer
Shell
2
star
19

commons-htmlunit

Common HtmlUnit utility methods that I find useful in various projects
Java
2
star
20

file-type-detection

A small tool to use Apache Tika to determine the mime-type of all files in a directory
Java
2
star
21

commons-test

Utilitity library for testing stuff that I use in multiple projects
Java
2
star
22

antlr-fuzz

Use Jazzer to perform fuzzy testing of antlr v4
Java
2
star
23

gwt-gradle-example-issue81

Reproducer for reported issue #81 in the gwt-gradle-plugin
Java
2
star
24

git-ftp-ppa

Git-ftp sources with Debian/Ubuntu packaging for building for PPA
Shell
2
star
25

cover-the-world

A tool which reads GPX tracks and produces a world-map which displays covered "tiles", i.e. ~1.5km squares
Java
2
star
26

kphotoalbum-ppa

KPhotoAlbum sources with Debian/Ubuntu packaging for PPA created using git-buildpackage
C++
1
star
27

kdesvn-ppa

Kdesvn sources with Debian/Ubuntu packaging for PPA created using git-buildpackage
C++
1
star
28

mp3splt-ppa

mp3splt sources with Debian/Ubuntu packaging for PPA created using git-buildpackage
C
1
star
29

codec-fuzz

Use Jazzer to perform fuzzy testing of Apache Commons Codec
Java
1
star
30

gpx2route

Convert GPX files to route files suitable for upload to Suunto Ambit sports watches via Openambit
Java
1
star
31

qrencode-ppa

qrencode sources with Debian/Ubuntu packaging for PPA created using git-buildpackage
Shell
1
star
32

dynahist-fuzz

Use Jazzer to perform fuzzy testing of dynahist
Java
1
star
33

scribus-ppa

Scribus sources with Debian/Ubuntu packaging for PPA created using git-buildpackage
C++
1
star
34

tpm2-tss-ppa

tpm2-tss sources with Debian/Ubuntu packaging for PPA created using git-buildpackage
C
1
star
35

BenfordsLaw

Sample application showing Benford's Law by looking at file sizes on the local disk
Java
1
star
36

ocserv-ppa

ocserv sources with Debian/Ubuntu packaging for PPA created using git-buildpackage
C
1
star
37

tellico-ppa

Tellico sources with Debian/Ubuntu packaging for PPA created using git-buildpackage
C++
1
star
38

onedrive-ppa

Onedrive sources with Debian/Ubuntu packaging for PPA created using git-buildpackage
D
1
star
39

bzstats

Query the Apache bugzilla instance for bug-counts and use R to produce an SVG with a chart of how bug-counts evolved
Jupyter Notebook
1
star
40

pacpl-ppa

PACPL sources with Debian/Ubuntu packaging for PPA created using git-buildpackage
Perl
1
star
41

pipewire-ppa

pipewire sources with Debian/Ubuntu packaging for PPA created using git-buildpackage
C
1
star
42

hash4j-fuzz

Use Jazzer to perform fuzzy testing of hash4j
Java
1
star
43

mtools-ppa

Mtools sources with Debian/Ubuntu packaging for building for PPA with support for xz created using git-buildpackage
C
1
star
44

compress-fuzz

Use Jazzer to perform fuzzy testing of Apache Commons Compress
Java
1
star
45

pkg-kde-tools.ppa

pkg-kde-tools sources with Debian/Ubuntu packaging for PPA created using git-buildpackage
1
star
46

konsole-ppa

konsole sources with Debian/Ubuntu packaging for PPA created using git-buildpackage
C++
1
star
47

firehol-ppa

firehol sources with Debian/Ubuntu packaging for PPA created using git-buildpackage
Shell
1
star
48

MultiplicativeDigitalRoot

This project plays with the mathematical topics of "Multiplicative digital roots" and "Multiplicative Persistence"
Java
1
star
49

tob-ppa

Tob (tape oriented backup) sources with Debian/Ubuntu packaging for PPA created using git-buildpackage
Shell
1
star
50

jacococoveragecolumn-plugin

Plugin for Jenkins to add a column for coverage results from the JaCoCo plugin
Java
1
star
51

dpkg-ppa

Dpkg sources with Debian/Ubuntu packaging for PPA created using git-buildpackage
C
1
star
52

poi-regression-test

A tool to perform regression testing for Apache POI on a very large corpus of test-files
Java
1
star
53

subversion-ppa

Subversion sources with Debian/Ubuntu packaging for PPA created using git-buildpackage
C
1
star
54

glabels-ppa

Glabels sources with Debian/Ubuntu packaging for PPA created using git-buildpackage
C
1
star
55

mp3gain-ppa

mp3gain sources with Debian/Ubuntu packaging for PPA created using git-buildpackage
C
1
star
56

laminar-ppa

Laminar sources with Debian/Ubuntu packaging for PPA created using git-buildpackage
C++
1
star
57

mp3splt-gtk-ppa

mp3splt-gtk sources with Debian/Ubuntu packaging for PPA created using git-buildpackage
C
1
star
58

.github

Default community health files
1
star
59

ntp-ppa

ntp sources with Debian/Ubuntu packaging for PPA created using git-buildpackage
C
1
star
60

csv-fuzz

Use Jazzer to perform fuzzy testing of Apache Commons CSV
Java
1
star
61

openconnect-ppa

openconnect sources with Debian/Ubuntu packaging for PPA created using git-buildpackage
C
1
star
62

debhelper-ppa

Debhelper sources with Debian/Ubuntu packaging for PPA created using git-buildpackage
Perl
1
star
63

simple-scan-ppa

simple-scan sources with Debian/Ubuntu packaging for PPA created using git-buildpackage
Vala
1
star
64

imaging-fuzz

Use Jazzer to perform fuzzy testing of Apache Commons Imaging
Java
1
star
65

libmp3splt-ppa

libmp3splt sources with Debian/Ubuntu packaging for PPA created using git-buildpackage
C
1
star
66

git-ppa

Git sources with Debian/Ubuntu packaging for PPA created using git-buildpackage
C
1
star
67

digikam-ppa

Digikam sources with Debian/Ubuntu packaging for PPA created using git-buildpackage
C++
1
star
68

poi-benchmark

Some automated benchmarks of POI buildsystem and some POI functionality together with results
HTML
1
star
69

subversion-19-ppa

Subversion sources with Debian/Ubuntu packaging for PPA created using git-buildpackage
C
1
star
70

marble-qt4-ppa

Marble sources with Debian/Ubuntu packaging for building for PPA with support for Qt4 instead of Qt5 created using git-buildpackage
C++
1
star
71

file-leak-postprocess

A small tool to post-process output from running an application with file-leak-detector
Java
1
star
72

tika-fuzz

Use Jazzer to perform fuzzy testing of Apache Tika
Java
1
star
73

bless-ppa

Bless sources with Debian/Ubuntu packaging for PPA created using git-buildpackage
C#
1
star
74

soundkonverter-ppa

Soundkonverter sources with Debian/Ubuntu packaging for PPA created using git-buildpackage
C++
1
star