merge ssh smb guide

This commit is contained in:
makayabou 2020-09-09 14:00:19 +02:00
commit 8a10574994

View File

@ -11,6 +11,48 @@ sudo apt install openssh-server
### Configuration
!!! note "/etc/ssh/sshd_config"
```
# Define a diferent port from default port=22
Port 43000
# certificate location
HostKey /etc/ssh/ssh_host_ecdsa_key
# Opening time of TCP session
LoginGraceTime 20s
# Maximum authentification Tries
MaxAuthTries 3
# Maximum sessions in same time
MaxSessions 1
# Authentification by public key
PubkeyAuthentication yes
# Authentication by Password
PasswordAuthentication no
# Question-Answer between server and client to validate authentication
ChallengeResponseAuthentication yes
# Message of the day
PrintMotd no
# Language of your local machine
AcceptEnv LANG LC_*
```
### Démarrage du serveur ssh
sudo systemctl restart sshd.service
=======
# Création d'un serveur local avec partage de fichiers Samba et backup des données en externe
## Installation de SSH
### Installation
```
sudo apt update
sudo apt install openssh-server
```
### Configuration
!!! note "/etc/ssh/sshd_config"
```
Port 43000
@ -82,13 +124,11 @@ sudo apt install openssh-server
### Création du script de sauvegarde
!!! note "/home/$USER/start_backup.sh"
#!/bin/bash
```
#!/bin/bash
rsync -ahv --update --delete --info=backup2,copy2,del2,name1,stats2 --log-file="/home/$USER/backup_log/backup.log.$(date +%Y-%m-%d)" /home/$USER/Documents/ -e 'ssh -p 3333' $USER@176.151.59.186:/home/$USER/Documents &
```
### Création du cron
echo "0 2 * * * $USER bash /home/$USER/start_backup.sh # the script file backup.sh is scheduled to be executed every day at 2:00AM." |sudo tee -a /etc/crontab