Verified Commit 639e3e09 authored by Elias Ojala's avatar Elias Ojala
Browse files

Additions

parent ec4d426c
---
title: Tips for fresh Debian server
permalink: /debian/server/tips/
---
## Forward mail elsewhere
**Requires a [MTA](https://en.wikipedia.org/wiki/Message_transfer_agent) such as [Postfix](http://www.postfix.org/))**
By default, Debian sends your email (security notifications, delivery errors, etc.) to `/var/mail/$USER` (can be read using a MUA such as [mutt](http://www.mutt.org/) ([deb](https://packages.debian.org/stretch/mutt))). If you are not reading your mail locally, you can forward it to your normal mailbox.
```bash
echo "user@example.com" > ~/.forward
```
Make sure your machine's hostname/mailname is not `example.com`.
### Forward `root@hostname` to `actualadmin@hostname`
If you used [Debian-Installer](https://en.wikipedia.org/wiki/Debian-Installer) instead of [cloud-init](https://cloud-init.io/), this should be set automatically to the user you selected to use as non-root administrative user.
#### Testing
```bash
mail -s "hello" "root@$(hostname -f)" <<< "Hello world"
```
If this ends to your actual admin's mailbox instead of `root`'s mailbox, congratulations!
#### How-to
```console
# dpkg-reconfigure postfix
```
![dpkg-reconfigure postfix in action](./dpkg-reconfigure--postfix.png)
After running it, `/etc/aliases` should look something like this (notice the `root: actualadmin` line):
```
# /etc/aliases
mailer-daemon: postmaster
postmaster: root
nobody: root
hostmaster: root
usenet: root
news: root
webmaster: root
www: root
ftp: root
abuse: root
noc: root
security: root
root: actualadmin
```
Replace `actualadmin` with the administrative user you set.
\ No newline at end of file
......@@ -3,6 +3,10 @@ title: Disabling IPv6 on Linux
permalink: /disable-ipv6-linux/
---
This won't work on Arch Linux, see [Deprecation of /etc/sysctl.conf](https://www.archlinux.org/news/deprecation-of-etcsysctlconf/).
On Arch Linux, use `/etc/sysctl.d/99-disable-ipv6.conf` instead of `/etc/sysctl.conf`.
<!-- TODO: Add non-copypastable (to make it easier) # and $ to stylesheet -->
Sudo method:
......
......@@ -5,17 +5,32 @@ permalink: /lxd/
[LXD website](https://linuxcontainers.org/lxd/)
## Basics
### Create container
```bash
sudo lxc launch ubuntu:18.04 CONTAINER_NAME
```
You can then enter the newly created container by running:
```bash
sudo lxc exec CONTAINER_NAME bash
```
## Port forwarding
```bash
sudo lxc config device add CONTAINER_NAME PROXY_NAME proxy listen=tcp:0.0.0.0:PUBLIC_PORT connect=tcp:localhost:CONTAINER_PORT
sudo lxc config device add CONTAINER_NAME PROXY_NAME proxy listen=tcp:0.0.0.0:PUBLIC_PORT connect=tcp:127.0.0.1:CONTAINER_PORT
```
### Examples
<!-- Error: Invalid devices: Not an IP address: localhost -->
```bash
sudo lxc config device add haproxy haproxy-80 proxy listen=tcp:0.0.0.0:80 connect=tcp:localhost:80
sudo lxc config device add haproxy haproxy-80 proxy listen=tcp:0.0.0.0:80 connect=tcp:127.0.0.1:80
```
### Further reading
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment