johnsonmlw.github.io/johnsonmlw
Table of Contents
1. Context
- The following notes are for Debian Bookworm but should be reasonably transferrable to other linux/unix setups
- This page is written with org-mode on Emacs
2. Hints for these notes
- Ctrl (the keyboard control key) is represented in these notes a C; Alt key is M (for meta)
- Copy or paste in a PuTTY session with C-right click
- Linux commands below assume the user is logged in as root (could prepend sudo to each command instead)
- Emacs is the chosen editor below; a simple alternative is nano which has the advantage of likely being installed already
3. Editor
3.1. Emacs
Basic emacs commands
- C-x C-f Find file (open)
- C-x C-s Save
- C-x C-c Quit
- C-o Open recent file (once configured as below)
- C-k Cut this line (kill)
- C-y Paste (yank)
Install and configure
- Install
# apt install emacs
- Confgure basic useful setup (here we create our .emacs config file)
# emacs .emacs
- Paste the following
(require 'package) (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) (package-initialize) (custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(global-visual-line-mode t) '(inhibit-startup-screen t) '(ring-bell-function 'ignore) '(scroll-bar-mode nil) '(tool-bar-mode nil) '(window-divider-mode nil)) (recentf-mode 1) (global-set-key "\C-o" 'recentf-open-files) (menu-bar-mode -1) (fido-vertical-mode 1) (setq make-backup-files nil) (setq recentf-max-menu-items 25) (setq warning-minimum-level :error)
4. Samba
4.1. Preparation
4.2. A simple share, read/write for anyone
- Ownership of all new directories and files created by any samba client (e.g. Windows) is simplified by
force user = sam
(where sam is any standard linux user account)
Linux directories
Configure samba
Anonymous access
- For the simplest of guest shares, we can avoid clients (e.g. Windows) even asking our guest for a username and password by having exactly zero samba user accounts
- If these have been previously created and are not needed, optionally delete all samba accounts
4.3. Private user shares, and shared read/write for anyone
- Two users (sam and ba) each need a private directory; there is also a writeable shared directory
- We assume that users sam and ba have linux user accounts (not covered here)
directory mask
andcreate mask
ensure that new directories and files users create in [share] can be written to and deleted by any user
Linux directories
Configure samba
- Edit /etc/samba/smb.conf
# emacs /etc/samba/smb.conf
[global] map to guest = Bad User [sam] path = /srv/sam valid users = sam writeable = yes [ba] path = /srv/ba valid users = ba writeable = yes [share] path = /srv/share valid users = sam, ba writeable = yes directory mask = 0777 create mask = 0666
- Reload samba
# systemctl reload smb
Users sam and ba need samba user accounts (in addition to their linux accounts)
# pdbedit -a -u sam # pdbedit -a -u ba