19 Commits

Author SHA1 Message Date
3e1be7519e initial netlify form test 2020-10-18 14:50:16 -04:00
db7255c3c1 fixed include section 2020-10-07 19:34:54 -04:00
308fc94ed9 analytics includes 2020-10-07 19:31:12 -04:00
1ea489227e analytics 2020-10-07 19:25:39 -04:00
9d9e0525e5 plausible analytics trial 2020-10-07 19:22:10 -04:00
a556126ba0 new favicon 2020-10-07 19:13:14 -04:00
skoobasteeve
6b5525a071 Merge pull request #2 from skoobasteeve/nas-ubuntu
Nas ubuntu
2020-10-07 19:03:45 -04:00
e7324ee255 publish date updated 2020-10-07 19:02:24 -04:00
a1f18e5fc5 final revision 2020-10-07 18:56:34 -04:00
8c32aaf3fb nas-ubuntu boilerplate 2020-09-30 17:51:13 -04:00
0ebcc6aba5 Merge branch 'master' of github.com:skoobasteeve/skoobasteeve.github.io.2 2020-09-29 23:31:14 -04:00
cce1c3099d keybase verification 2020-09-29 23:31:06 -04:00
skoobasteeve
63eb1ed412 Update README.md 2020-09-29 20:51:56 -04:00
de31fbbb11 bing site verification 2020-09-29 20:46:18 -04:00
skoobasteeve
a6b4325687 Update README.md 2020-09-29 18:50:22 -04:00
skoobasteeve
4e6251a394 Create README.md 2020-09-29 18:49:53 -04:00
67724d876a added github to footer 2020-09-29 18:43:32 -04:00
5dac24093a nav bar and search 2020-09-29 18:25:34 -04:00
skoobasteeve
d92dfdc6b6 Merge pull request #1 from skoobasteeve/comments
utterances comments
2020-09-23 22:42:30 -04:00
11 changed files with 337 additions and 13 deletions

5
README.md Normal file
View File

@@ -0,0 +1,5 @@
# Ray Against the Machine
### A blog about Linux, privacy, and self-hosting.
https://rayagainstthemachine.net
[![Netlify Status](https://api.netlify.com/api/v1/badges/1aa76f43-af0b-4190-a92a-e267dfc6dfdf/deploy-status)](https://app.netlify.com/sites/quirky-edison-020dd8/deploys)

View File

@@ -21,7 +21,7 @@ title_separator : "-"
subtitle : "Breaking things so you don't have to."
name : "Ray Lyon"
description : "Linux, self-hosting, and privacy."
url : # "https://rayagainstthemachine.net"
url : "https://rayagainstthemachine.net"
baseurl : # the subpath of your site, e.g. "/blog"
repository : "skoobasteeve/skoobasteeve.github.io.2"
teaser : # path of fallback teaser image, e.g. "/assets/images/500x300.png"
@@ -51,9 +51,9 @@ reCaptcha:
secret :
atom_feed:
path : # blank (default) uses feed.xml
search : # true, false (default)
search_full_content : # true, false (default)
search_provider : # lunr (default), algolia, google
search : true
search_full_content : true
search_provider : lunr
algolia:
application_id : # YOUR_APPLICATION_ID
index_name : # YOUR_INDEX_NAME
@@ -64,7 +64,7 @@ google:
instant_search : # false (default), true
# SEO Related
google_site_verification :
bing_site_verification :
bing_site_verification : "AED815E51DB78F1E001983829425B08B"
yandex_site_verification :
naver_site_verification :
@@ -75,7 +75,7 @@ facebook:
username :
app_id :
publisher :
og_image : # Open Graph/Twitter default site image
og_image : "/assets/images/avatar.jpg"
# For specifying social profiles
# - https://developers.google.com/structured-data/customize/social-profiles
social:
@@ -85,11 +85,7 @@ social:
# Analytics
analytics:
provider : false # false (default), "google", "google-universal", "google-gtag", "custom"
google:
tracking_id :
anonymize_ip : # true, false (default)
provider : "custom"
# Site Author
author:
@@ -135,7 +131,7 @@ footer:
# url:
- label: "GitHub"
icon: "fab fa-fw fa-github"
# url:
url: "https://github.com/skoobasteeve"
- label: "GitLab"
icon: "fab fa-fw fa-gitlab"
# url:
@@ -215,7 +211,7 @@ sass:
permalink: /:categories/:title/
paginate: 5 # amount of posts to show
paginate_path: /page:num/
timezone: # https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
timezone: America/New_York
# Plugins (previously gems:)
@@ -286,3 +282,4 @@ defaults:
share: true
related: true
classes: wide
show_date: true

7
_data/navigation.yml Normal file
View File

@@ -0,0 +1,7 @@
main:
- title: "About"
url: /about/
- title: "Tags"
url: /tags/
- title: "Categories"
url: /categories/

View File

@@ -0,0 +1 @@
<script async defer data-domain="rayagainstthemachine.net" src="https://plausible.io/js/plausible.js"></script>

13
_pages/about.md Normal file
View File

@@ -0,0 +1,13 @@
---
layout: single
title: About
permalink: /about/
---
I love Linux, open-source, and technology in general.
This blog was built using [Jekyll](https://jekyllrb.com/) and the [Minimal Mistakes](https://github.com/mmistakes/minimal-mistakes) theme. All updates and tweaks can be followed on by GitHub repo linked in the sidebar.
I'm not very active on social media, but feel free to email me or leave a comment if you want to get in touch. You'll likely receive a quick response as I jump on any opportunity to talk tech.
Thanks and Happy Hacking!

5
_pages/categories.md Normal file
View File

@@ -0,0 +1,5 @@
---
layout: categories
title: Categories
permalink: /categories/
---

25
_pages/contact.md Normal file
View File

@@ -0,0 +1,25 @@
---
layout: single
title: Contact
permalink: /contact/
---
<form name="contact" netlify>
<p>
<label>Name <input type="text" name="name" /></label>
</p>
<p>
<label>Email <input type="email" name="email" /></label>
</p>
<p>
<label>Phone <input type="text" name="phone" /></label>
</p>
<p>
<label>+1 (If applicable) <input type="text" name="plusone" /></label>
</p>
<p>
<label>Comments <input type="text" name="comments" /></label>
</p>
<p>
<button type="submit">Send</button>
</p>
</form>

5
_pages/tags.md Normal file
View File

@@ -0,0 +1,5 @@
---
layout: tags
title: Tags
permalink: /tags/
---

View File

@@ -0,0 +1,196 @@
---
layout: single
title: "Painless On-Demand NAS Connections in Linux with Systemd Automount"
date: 2020-10-07 19:00:00
categories: [Linux Administration]
tags: linux samba nas systemd ubuntu
comments: true
---
If you have a NAS, you probably want to be able to connect to it automatically each time you log into your Linux machine. Adding an entry to your fstab is great for desktops with persistent ethernet connections, but you quickly run into trouble using this method on a laptop that's frequently jumping on and off the network. Your distribution's file manager may have a way to do this, but wouldn't it be nice to have a consistent method accross all modern distributions? Systemd to the rescue!
Instead of trying to mount the network shares at login or boot, we're going to mount them on-demand by combining Systemd mount and automount units. With this method, the shares won't appear until you navigate to the designated mount points in the terminal or file manager.
*NOTE:* These instructions were written for **Ubuntu 20.04**, but the principles should apply to nearly all modern distributions. Adjust for your distro's package manager and install locations.
### Systemd Unit Files
If you're not familiar with Systemd unit files and how they work, I would highly recommend reading the [Freedesktop.org article](https://www.freedesktop.org/software/systemd/man/systemd.unit.html) on the subject. Unit files are effectively services that can be run on-demand or triggered by events or specific times. For our purposes, we're going to use both [mount](https://www.freedesktop.org/software/systemd/man/systemd.mount.html#) and [automount](https://www.freedesktop.org/software/systemd/man/systemd.automount.html#) unit files.
### Create a mount point
You'll need to create dedicated folders on your machine where the shares will be mounted.
``` bash
$ sudo mkdir -p /mnt/smb/sambashare
$ sudo mkdir -p /mnt/nfs/nfsshare
```
### Create a credentials file
If your Samba server uses authentication, you'll need to create a file with your login details that Systemd can use to connect. These should be saved in a safe location with restricted permissions.
``` bash
$ sudo nano /etc/samba/smbcreds
```
```
username=[USERNAME]
password=[PASSWORD]
```
``` bash
$ sudo chmod 600 /etc/samba/smbcreds
```
### Install the client packages
#### Samba
``` bash
$ sudo apt install samba cifs-utils
```
#### NFS
``` bash
$ sudo apt install nfs-common
```
### Create the systemd unit files
To make this work, we need (2) unit files for each connection: the **mount** unit and the **automount** unit. These use a specific naming convention that follows the path of the mount point. For example, if our share is at `/mnt/smb/sambashare` the mount file should be named `mnt-smb-sambashare.mount`. The same goes for the automount file. **If you don't name the units this way they will not function.**
The below instructions assume your samba share is located at `//example.server/sambafiles`.
``` bash
$ sudo nano /etc/systemd/system/mnt-smb-sambashare.mount
```
```
[Unit]
Description=samba mount for sambafiles
Requires=systemd-networkd.service
After=network-online.target
Wants=network-online.target
[Mount]
What=//example.server/sambafiles
Where=/mnt/smb/sambashare
Options=vers=2.1,credentials=/etc/samba/smbcreds,iocharset=utf8,rw,x-systemd.automount,uid=1000
Type=cifs
TimeoutSec=30
[Install]
WantedBy=multi-user.target
```
A few notes on the above file:
* `vers=2.1` - adjust this based on the version of samba running on your server
* `uid=1000` - adjust this based on your local user ID to avoid permissions problems. This is usually 1000 on a desktop system.
\
Next we need to create the automount file in the same location.
``` bash
$ sudo nano /etc/systemd/system/mnt-smb-sambashare.automount
```
```
[Unit]
Description=samba automount for yourfiles
Requires=network-online.target
[Automount]
Where=/mnt/smb/sambashare
TimeoutIdleSec=0
[Install]
WantedBy=multi-user.target
```
#### NFS
The below instructions assume your NFS share is located at `example.server:/srv/nfsfiles`.
``` bash
$ sudo nano /etc/systemd/system/mnt-nfs-nfssahre.mount
```
```
[Unit]
Description = nfs mount for nfsfiles
[Mount]
What=example.server:/srv/nfsfiles
Where=/mnt/nfs/nfsshare
Type=nfs
Options=defaults
[Install]
WantedBy=multi-user.target
```
\
Same as before, we need to create the automount file in the same location.
``` bash
$ sudo nano /etc/systemd/system/mnt-smb-nfsshare.automount
```
```
[Unit]
Description=nfs automount for nfsfiles
Requires=network-online.target
[Automount]
Where=/mnt/nfs/nfsshare
TimeoutIdleSec=0
[Install]
WantedBy=multi-user.target
```
\
NFS mounts by nature are a bit more straightforward than samba. In an all-Linux environment they will lead to fewer headaches and I recommend them highly.
### Put them to work!
At this point your unit files are ready to go but systemd doesn't know about them. Run the following commands to test your mount:
```
$ sudo systemctl daemon-reload
$ sudo systemctl start mnt-nfs-nfsshare.mount
$ sudo systemctl start mnt-smb-smbshare.mount
```
\
If all went well, you should see your file shares at their designated mount points. To verify, check the status of your service and look for any errors.
```
$ sudo systemctl status mnt-nfs-nfsshare.mount
● mnt-smb-sambashare.mount - samba mount for sambafiles
Loaded: loaded (/etc/systemd/system/mnt-smb-sambashare.mount; static; vendor preset: enabled)
Active: active (mounted) since Wed 2020-10-07 18:05:34 EDT; 1min 1s ago
Where: /mnt/smb/sambashare
What: //example.server/sambafiles
Process: 13005 ExecMount=/bin/mount //example.server/sambashare /mnt/smb/sambashare -t cifs -o vers=2.1,credentials=/etc/samba/smbcreds,iocharset=utf8,rw,x-systemd.automount,uid=1000 (code=exited, status=0/SUCCESS)
Tasks: 0 (limit: 4915)
CGroup: /system.slice/mnt-smb-sambashare.mount
Oct 07 18:05:34 raylyon-ThinkPad-T450s systemd[1]: Mounting samba mount for sambafiles...
Oct 07 18:05:34 raylyon-ThinkPad-T450s systemd[1]: Mounted samba mount for sambafiles.
```
\
Next, enable your automount files to start at boot. This will allow your shares to mount on-demand.
```
$ sudo systemctl enable mnt-nfs-nfsshare.automount
$ sudo systemctl enable mnt-smb-smbshare.automount
```
\
That's it! To test, reboot your system, open the mountpoint in terminal or the file manager, and your share will mount before your eyes. If you have any questions or critiques on the above instructions, please shoot me an [email](mailto:ray@raylyon.net) or open a [Github issue](https://github.com/skoobasteeve/skoobasteeve.github.io.2/issues).
Thanks for reading and happy hacking!

BIN
favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

70
keybase.txt Normal file
View File

@@ -0,0 +1,70 @@
==================================================================
https://keybase.io/scubasteve
--------------------------------------------------------------------
I hereby claim:
* I am an admin of https://rayagainstthemachine.net
* I am scubasteve (https://keybase.io/scubasteve) on keybase.
* I have a public key with fingerprint 2DC3 A106 6BBA 7040 FE79 63D9 E201 06CB 86FE 0B4D
To do so, I am signing this object:
{
"body": {
"key": {
"eldest_kid": "0101e41e47195eb3648d6749c082c9031f8430aa7754480489667f762175ba3dc14b0a",
"fingerprint": "2dc3a1066bba7040fe7963d9e20106cb86fe0b4d",
"host": "keybase.io",
"key_id": "e20106cb86fe0b4d",
"kid": "0101e41e47195eb3648d6749c082c9031f8430aa7754480489667f762175ba3dc14b0a",
"uid": "9590a31db610cd32597a24ad832c4719",
"username": "scubasteve"
},
"service": {
"hostname": "rayagainstthemachine.net",
"protocol": "https:"
},
"type": "web_service_binding",
"version": 1
},
"ctime": 1600466197,
"expire_in": 157680000,
"prev": "38d8c85ecab91b9bd8427dc43ed7628c85b815d3ced37b98bf182b825a5a67a0",
"seqno": 12,
"tag": "signature"
}
which yields the signature:
-----BEGIN PGP MESSAGE-----
owGtUm1sFEUYvsO2tNQT4gdWRalLK0Lu6H5/lIRosPHrOCUFAorezczO3i2lu3e7
e1fbiga1ChjSCigNBAJRq2gsjSASbW2R2B62jcWCUoNoLEJqRITqUdrkdLaBf/50
Mslk3nme533eJ9Pku8GT7/3Fm9f7arZwibd3BHrCOHBHPQVNt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ESSAGE-----
And finally, I am proving ownership of this host by posting or
appending to this document.
View my publicly-auditable identity here: https://keybase.io/scubasteve
==================================================================