mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2024-11-26 06:31:04 +01:00
refactored
This commit is contained in:
parent
7fe777c5f8
commit
278d61759a
@ -1,16 +0,0 @@
|
|||||||
# Create sftp group
|
|
||||||
# groupadd sftpusers
|
|
||||||
# useradd -g sftpusers -d /incoming -s /sbin/nologin guestuser
|
|
||||||
# passwd guestuser
|
|
||||||
# grep guestuser /etc/passwd
|
|
||||||
# usermod -g sftpusers -d /incoming -s /sbin/nologin john
|
|
||||||
# Subsystem sftp internal-sftp > /etc/ssh/sshd_config
|
|
||||||
# tail /etc/ssh/sshd_config
|
|
||||||
# mkdir /sftp
|
|
||||||
# mkdir /sftp/guestuser
|
|
||||||
# mkdir /sftp/guestuser/incoming
|
|
||||||
# chown guestuser:sftpusers /sftp/guestuser/incoming
|
|
||||||
# ls -ld /sftp/guestuser/incoming
|
|
||||||
# ls -ld /sftp/guestuser
|
|
||||||
# ls -ld /sftp
|
|
||||||
# service sshd restart
|
|
@ -6,16 +6,21 @@ then
|
|||||||
echo "`/bin/date`: $SSH_ORIGINAL_COMMAND" | systemd-cat -t "ssh-wrapper.sh"
|
echo "`/bin/date`: $SSH_ORIGINAL_COMMAND" | systemd-cat -t "ssh-wrapper.sh"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# define executable commands
|
||||||
|
hashed_machine_id_command="sha256sum /etc/machine-id";
|
||||||
|
find_command="find /Backups/{{hashed_machine_id.stdout}}/ -maxdepth 1 -type d";
|
||||||
|
rsync_command="sudo rsync --server --sender -blogDtpre.iLsfxCIvu --backup-dir /Backups/{{hashed_machine_id.stdout}}/docker-volume-backup/diffs/current/ . /Backups/{{hashed_machine_id.stdout}}/docker-volume-backup/latest/"
|
||||||
|
|
||||||
# filter commands
|
# filter commands
|
||||||
case "$SSH_ORIGINAL_COMMAND" in
|
case "$SSH_ORIGINAL_COMMAND" in
|
||||||
"sha256sum /etc/machine-id")
|
"$hashed_machine_id_command")
|
||||||
sha256sum /etc/machine-id
|
$hashed_machine_id_command
|
||||||
;;
|
;;
|
||||||
"find /Backups/{{hashed_machine_id.stdout}}/ -maxdepth 1 -type d")
|
"$find_command")
|
||||||
find /Backups/{{hashed_machine_id.stdout}}/ -maxdepth 1 -type d
|
$find_command
|
||||||
;;
|
;;
|
||||||
"sudo rsync --server --sender -blogDtpre.iLsfxCIvu --backup-dir /Backups/{{hashed_machine_id.stdout}}/docker-volume-backup/diffs/current/ . /Backups/{{hashed_machine_id.stdout}}/docker-volume-backup/latest/")
|
"$rsync_command")
|
||||||
sudo rsync --server --sender -blogDtpre.iLsfxCIvu --backup-dir /Backups/{{hashed_machine_id.stdout}}/docker-volume-backup/diffs/current/ . /Backups/{{hashed_machine_id.stdout}}/docker-volume-backup/latest/
|
$rsync_command
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "This command is not supported."
|
echo "This command is not supported."
|
||||||
|
Loading…
Reference in New Issue
Block a user