restic/vm-esh-nas: fix htpasswd-append example — root_squash awareness
The Anaheim NAS exports /mnt/backup with root_squash, so sudo-as-root on ana-docker becomes nobody on the NFS side and `sudo tee` gets EACCES. The repo tree is owned by lkraven:lkraven precisely because of this — all writes go through the lkraven UID. Drop sudo from the example; plain `>>` append as lkraven works.
This commit is contained in:
@@ -49,18 +49,24 @@ ssh -t vm-esh-nas 'sudo apt update && sudo apt install -y restic'
|
|||||||
If not already present from an earlier pass:
|
If not already present from an earlier pass:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Single ssh invocation — the pipe must stay on the REMOTE side so
|
# The repo dir is on NFS from the Debian NAS (10.250.50.50) exported with
|
||||||
# sudo can prompt on the local keyboard. `ssh -t ... | ssh -t ...`
|
# root_squash, so sudo gets denied writes. It is owned by lkraven:lkraven,
|
||||||
# breaks because sudo's password read conflicts with the pipe contents.
|
# so append as lkraven directly — no sudo needed.
|
||||||
ssh -t ana-docker '
|
ssh ana-docker '
|
||||||
docker run --rm httpd:2.4-alpine htpasswd -nbB vm-esh-nas "<PW>" \
|
docker run --rm httpd:2.4-alpine htpasswd -nbB vm-esh-nas "<PW>" \
|
||||||
| sudo tee -a /mnt/backup/restic/repo/ana/.htpasswd >/dev/null
|
>> /mnt/backup/restic/repo/ana/.htpasswd
|
||||||
'
|
'
|
||||||
```
|
```
|
||||||
|
|
||||||
Heads-up: the password is in your shell history after this runs.
|
Heads-up: the password is in your shell history after this runs.
|
||||||
Scrub with `history -d <line>` or `history -c`.
|
Scrub with `history -d <line>` or `history -c`.
|
||||||
|
|
||||||
|
Sanity check the file ownership afterward:
|
||||||
|
```bash
|
||||||
|
ssh ana-docker 'ls -la /mnt/backup/restic/repo/ana/.htpasswd'
|
||||||
|
# expect: -rw------- 1 lkraven lkraven ...
|
||||||
|
```
|
||||||
|
|
||||||
### 3. Install restic creds on vm-esh-nas
|
### 3. Install restic creds on vm-esh-nas
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
Reference in New Issue
Block a user