# Linux Config Snippets
- [Bash Customization](#Bash-Customization)
* [Case Insensitive Tab Completion](#Case-Insensitive-Tab-Completion)
- [SSH](#SSH)
* [Setup Remote Access by SSH Key](#Setup-Remote-Access-by-SSH-Key)
## Bash Customization
### Case Insensitive Tab Completion
```sh
echo "set completion-ignore-case on" >> ~/.inputrc
source ~/.bashrc
```
---
## SSH
### Setup Remote Access by SSH Key
1. Create RSA Key Pair
```sh
ssh-keygen
```
> NOTE: If an SSH key already exists you will be prompted to overwrite it - Don't do it
1. Copy the Public Key to the Server
Using the `ssh-copy-id` command if it's available
```sh
ssh-copy-id username@remote_host
```
If the `ssh-copy-id` command isn't available this is an alternative
```sh
cat ~/.ssh/id_rsa.pub | ssh username@remote_host "mkdir -p ~/.ssh && touch ~/.ssh/authorized_keys && chmod -R go= ~/.ssh && cat >> ~/.ssh/authorized_keys"
```
1. Authenticate to the Server Using SSH Keys
```sh
ssh username@remote_host
```
1. Disable Password Authentication on the Server (Optional)
Edit the `/etc/ssh/sshd_config` file and Add the following line (or update it if it exists)
```
...
PasswordAuthentication no
...
```
Save the file and restart the `ssh` service by running
```sh
sudo systemctl restart ssh
```
> Before closing the terminal check that you are able to login from another terminal to avoid getting locked out