ShellHacks
42 subscribers
167 links
www.ShellHacks.com | Command-Line Tips & Tricks
Download Telegram
🌐 Bad owner or permissions on β€˜.ssh/config’ [SOLVED]

Starting from Windows 10 build 1809, Windows has a native SSH client that is based on the OpenSSH port.

If you try to connect to some host from a Windows command line (CMD) or PowerShell using the ssh command, you may receive the error as follows:

Bad owner or permissions on C:\\Users\\<username>/.ssh/config

This short note shows how to fix the permissions on all the files under the C:\\Users\\<username>/.ssh folder.

πŸ“– Continue Reading
🌐 Mount NFS in Kubernetes Pod

An NFS (Network File System) is one of the most useful volume types in Kubernetes.

To mount a directory shared from an NFS server to a container running in a Kubernetes Pod it is required to do the following:


Add the NFS volume to the Pod.
Set the NFS server and path to the share.
Mount the NFS volume in the container.


This note shows how to mount the NFS in the Kubernetes Pod by creating the appropriate manifest file in YAML.

πŸ“– Continue Reading
🌐 Git: Create Empty Branch

By default, the commands git branch <newBranchName> and git checkout -b <newBranchName> create a new branch from the current one.

This means that the new branch will be based on your currently checked out (HEAD) branch, i.e. will contain all the files and commits from the parent branch.

Let's assume that you want to create a new empty branch without any inherited files or commits.

This short note shows how to do this.

πŸ“– Continue Reading
🌐 Kubectl: Get All Resources in Namespace

The kubectl get all command is used to list down such Kubernetes resources as Pods, Services, StatefulSets, etc.

But this command doesn't really list all the resources in a Namespace.

To really get all the Kubernetes resources in the Namespace we can use the combination of the kubectl api-resources and kubectl get commands.

This short note shows how to get all the resources in the Namespace using the kubectl.

πŸ“– Continue Reading
🌐 Microsoft Edge: Bypass NET::ERR_CERT_AUTHORITY_INVALID

Usually, when you get the NET::ERR_CERT_AUTHORITY_INVALID error in a Microsoft Edge browser you can bypass it by going to "Advanced" and clicking on "Continue to <website> (unsafe)" option.

But it may happen that there is no such option in "Advanced".

This short note shows how to bypass the error NET::ERR_CERT_AUTHORITY_INVALID in the Microsoft Edge if there is no "Continue to website (unsafe)" option.

πŸ“– Continue Reading
🌐 Generate SSH Key in Windows

Starting from Windows 10 build 1809, Windows has a native SSH client that is based on the OpenSSH port.

The OpenSSH client in Windows includes an ssh-keygen - the command-line tool for creating authentication keys for SSH.

To create a pair of SSH keys in Windows, the ssh-keygen command can be executed from a Windows command-line prompt (CMD) or PowerShell.

This note shows how to generate SSH keys in Windows using the ssh-keygen command.

πŸ“– Continue Reading
🌐 MikroTik: WiFi Configuration – Simple Setup

The very common usage of a MikroTik WiFi router is to create a password protected wireless access point (WAP).

In this post I will show a very quick overview for beginners on setting up the WAP on the MikroTik router WiFi.

To start configuring the WiFi on the MikroTik router is is required to connect to it using WinBox/WinFig (RouterOS graphical configuration tools) or using SSH for once who prefer a command line.

πŸ“– Continue Reading
🌐 Git: Migrate Repository

If you want to move from one Git server to another, you will need to migrate your Git repositories.

This note shows how to migrate a Git repository with all its history, branches and tags from one Git server to another.

This method is simple, straightforward and can be used to move you Git repository to GitHub, GitLab, Bitbucket or any other Git server.

πŸ“– Continue Reading
🌐 MikroTik: List Firewall Rules

MikroTik RouterOS has a very powerful firewall implementation.

By default it is enabled and contains that rules that allow to ping to your MikroTik router from outside, access it from LAN and drop everything from WAN.

This short note shows how to list firewall rules on a MikroTik router through the WinBox/WinFig interface or from the command line.

πŸ“– Continue Reading
🌐 Helm: List Repos & Charts in Repo

Helm uses a packaging format called charts (a collection of Kubernetes resource files).

Helm chart repositories are remote HTTP servers where packaged charts can be stored and shared.

This short note shows how to list Helm charts and repositories using the helm command.

πŸ“– Continue Reading
🌐 Systemd Service Not Starting (status=217/USER)

A systemd service may fail to start with the error:

Main process exited, code=exited, status=217/USER

The status=217/USER indicates that the user that is configured to run the service could not be found.

This could happen if there is a typo in a username or you have copied a service file from another machine and it contains the user that doesn't exists on your system.

This also could happen if the user that should run the service is not the local one but comes from some external authentication provider, like LDAP or Active Directory.

This short note shows how to fix the "Main process exited, code=exited, status=217/USER" error for such external user.

πŸ“– Continue Reading
🌐 GitHub Actions: Self-Signed Certificate Error

If in a GitHub Actions workflow you try to check out a repository from an URL with a self-signed certificate or a certificate signed by a non-trusted certificate authority (CA), you will get this error:

request to <URL> failed, reason: self signed certificate in certificate chain

In this note i will show how to fix the self-signed certificate error in GitHub Actions by adding trusted CA certificates.

πŸ“– Continue Reading
🌐 Helm: Download Chart & Save Locally

Helm uses a packaging format called charts (a collection of Kubernetes resource files).

Helm charts can be downloaded and saved locally using the helm pull command.

This short note shows how to download a Helm chart from a repository and save it locally.

πŸ“– Continue Reading
🌐 Helm: Render Chart Templates Locally – Example

Helm chart templates in a combination with a values.yaml file, generate manifest files which are YAML-formatted Kubernetes resource descriptions.

The values.yaml file contains default configuration values for a chart.

These default values can be overriding with custom values using special flags.

Before applying to a Kubernetes cluster, the Helm chart templates can be rendered locally and printed to a terminal or saved to a file.

In this note i will show the examples of how to render the Helm chart templates locally using a helm template command.

πŸ“– Continue Reading
🌐 tun0: Rename OpenVPN Client Interface

When an OpenVPN client establishes a connection with a server, by default, it uses a /dev/net/tun virtual network device and spawns a tunX interface.

If you have only one OpenVPN client, most of all the name of the interface is tun0 as, by default, there is a dev tun setting in the OpenVPN client's .ovpn configuration file.

If you have multiple OpenVPN clients on the same machine the later started ones will spawn tunX interfaces from zero, i.e., tun1, tun2, etc.

In case of the multiple OpenVPN clients you may want them to spawn the interfaces with their own predefined names instead of using dynamically assigned ones.

This is useful if, for example, you want to set up different iptables firewall rules for them.

This note shows how to change the name of the OpenVPN client's interface.

πŸ“– Continue Reading
🌐 GitHub Actions: Parallel Jobs – Example

A workflow in a GitHub Actions can be optimized by splitting it into several jobs, which run in parallel by default.

Parallel jobs is a great way to improve build times and provide a faster feedback to your development & QA teams.

This note shows how to run jobs in parallel in the Github Actions.

πŸ“– Continue Reading
🌐 Git Bash: Install jq

jq is a command-line tool for parsing a JSON data (like grep or sed for a text data).

You can use the jq command on Windows using a Git Bash, but firstly it has to be installed as it is not amount the default tools.

This note shows how to install the jq for the Git Bash on Windows.

πŸ“– Continue Reading
🌐 Git Bash: Increase Terminal Scrollback Buffer Size

If you run a command that produces a lot of output in a Git Bash and you try to scroll up to the beginning of that output, you may see that it has been truncated.

The number of lines that can be displayed in the Git Bash is controlled by a scrollback buffer size (10000 lines, by default).

This short note shows how to increase the terminal scrollback buffer size in the Git Bash.

πŸ“– Continue Reading
🌐 Helm: List Installed Charts

Helm uses a packaging format called charts (a collection of Kubernetes resource files).

Helm charts installed on a Kubernetes cluster can be listed by using a helm command.

This short note shows how to list all the Helm charts installed by the helm command.

πŸ“– Continue Reading
🌐 Helm: Get Values

When you install a Helm chart into a Kubernetes cluster you can pass custom values to configure the release.

Comparing versions of Helm values and reviewing old releases is a good practice for keeping track of changes.

Below you will find how to get values of a Helm chart release using a helm get values command.

πŸ“– Continue Reading