snippets:security
Differences
This shows you the differences between two versions of the page.
| snippets:security [2025-08-01 05:56] – created malte70 | snippets:security [2026-01-20 10:37] (current) – Abschnitt „SFTP-only Benutzer“ hinzugefügt malte70 | ||
|---|---|---|---|
| Line 47: | Line 47: | ||
| gpg --output Omas_Butterkuchen.pdf --decrypt Omas_Butterkuchen.pdf.gpg | gpg --output Omas_Butterkuchen.pdf --decrypt Omas_Butterkuchen.pdf.gpg | ||
| </ | </ | ||
| + | |||
| + | ===== SFTP-only Benutzer für Webspace-Kunden ===== | ||
| + | |||
| + | > Die folgenden Snippets sind eine Ergänzung/ | ||
| + | |||
| + | <code bash> | ||
| + | # | ||
| + | # Setup an SFTP-only user account | ||
| + | # | ||
| + | |||
| + | |||
| + | # | ||
| + | # Customer config | ||
| + | # | ||
| + | cfg_username=" | ||
| + | cfg_realname=" | ||
| + | cfg_uid=2103 | ||
| + | cfg_domain=" | ||
| + | |||
| + | |||
| + | # | ||
| + | # Generic Config | ||
| + | # | ||
| + | cfg_group=" | ||
| + | cfg_additional_groups=" | ||
| + | cfg_home_prefix="/ | ||
| + | cfg_comment_prefix=" | ||
| + | |||
| + | |||
| + | # | ||
| + | # Add new user | ||
| + | # | ||
| + | sudo useradd \ | ||
| + | --uid $cfg_uid \ | ||
| + | --comment " | ||
| + | --home-dir " | ||
| + | --gid " | ||
| + | --groups " | ||
| + | --shell /bin/false \ | ||
| + | " | ||
| + | |||
| + | |||
| + | # | ||
| + | # Directory structure | ||
| + | # | ||
| + | sudo mkdir -p " | ||
| + | sudo mount -o bind \ | ||
| + | / | ||
| + | ${cfg_home_prefix}${cfg_username}/ | ||
| + | |||
| + | echo "/ | ||
| + | | sudo tee --append /etc/fstab | ||
| + | |||
| + | |||
| + | # | ||
| + | # Basic setup for the new user | ||
| + | # | ||
| + | sudo passwd ${cfg_username} | ||
| + | |||
| + | new_home=$(getent passwd $cfg_username | cut -d: -f6) | ||
| + | |||
| + | sudo mkdir " | ||
| + | sudo cp ~/ | ||
| + | |||
| + | sudo chown -R ${cfg_username}: | ||
| + | sudo chmod 600 ${new_home}/ | ||
| + | </ | ||
| + | |||
snippets/security.1754027811.txt.gz · Last modified: by malte70
