feat(last-working-dir): log separate `lwd`s for different SSH keys on the same user account (#9534)
Co-authored-by: Marc Cornellà <hello@mcornella.com>master
parent
fae34b383d
commit
869eb20913
2 changed files with 31 additions and 11 deletions
@ -1,15 +1,33 @@ |
|||||||
# last-working-dir plugin |
# last-working-dir plugin |
||||||
|
|
||||||
Keeps track of the last used working directory and automatically jumps into it |
Keeps track of the last used working directory and automatically jumps into it |
||||||
for new shells, unless: |
for new shells, unless the starting directory is not `$HOME`. |
||||||
|
|
||||||
- The plugin is already loaded. |
Also adds a `lwd` function to jump to the last working directory. |
||||||
- The current `$PWD` is not `$HOME`. |
|
||||||
|
|
||||||
Also adds `lwd` function to jump to the last working directory. |
|
||||||
|
|
||||||
To use it, add `last-working-dir` to the plugins array in your zshrc file: |
To use it, add `last-working-dir` to the plugins array in your zshrc file: |
||||||
|
|
||||||
```zsh |
```zsh |
||||||
plugins=(... last-working-dir) |
plugins=(... last-working-dir) |
||||||
``` |
``` |
||||||
|
|
||||||
|
## Features |
||||||
|
|
||||||
|
### Use separate last-working-dir files with different SSH keys |
||||||
|
|
||||||
|
If the same user account is used by multiple users connecting via different SSH keys, you can |
||||||
|
configure SSH to map them to different `SSH_USER`s and the plugin will use separate lwd files |
||||||
|
for each one. |
||||||
|
|
||||||
|
Make sure that your SSH server allows environment variables. You can enable this feature |
||||||
|
within the `/etc/sshd/sshd_config` file: |
||||||
|
|
||||||
|
``` |
||||||
|
PermitUserEnvironment yes |
||||||
|
``` |
||||||
|
|
||||||
|
Then, add `environment="SSH_USER=<SSH_USERNAME>"` before the SSH keys in your `authorized_keys` file: |
||||||
|
|
||||||
|
``` |
||||||
|
environment="SSH_USER=a.test@example.com" ssh-ed25519 AAAAC3Nz... |
||||||
|
``` |
||||||
|
|||||||
Loading…
Reference in new issue