Changer à rootMise à jour et installation des paquets Code Block |
---|
apt-get -y update apt-get -y upgrade |
Installer les paquets Code Block |
---|
apt-get -y install sudo vim unzip rsync sysstat cifs-utils nmap tcpdump tmux virt-what chrony smbclient ufw curl net-tools nload |
Le VIM détecte la souris, et le copier-coller entre deux fenêtres de terminal est gênant à cause de cela. Désactivez cette fonction ceci comme suit pour root et jtel : Code Block |
---|
cat << EOFF >> ~/.vimrc set mouse-=a EOFF cp ~/.vimrc /home/jtel chown jtel:jtel /home/jtel/.vimrc |
La commande suivante ajoute l'utilisateur jtel au groupe sudo : Code Block |
---|
adduser jtel sudo |
Parfois, la commande ne fonctionne pas. Essayez d'ajouter "sudo" au début: Code Block |
---|
sudo adduser jtel sudo |
DebianTout d'abord, arrêtez la journalisation de l'ufw vers la destination syslog par défaut (/var/log/messages). Code Block |
---|
sed -i -e "s/^#\& stop/\& stop/" /etc/rsyslog.d/20-ufw.conf systemctl restart rsyslog |
Les commandes suivantes permettent d'activer le pare-feu et d'autoriser ssh. Code Block |
---|
ufw --force reset ufw --force default deny incoming ufw --force default allow outgoing ufw allow ssh ufw --force enable |
Les commandes suivantes installent chrony et modifient le fichier chrony.conf de base pour supprimer l'utilisation du pool par défaut et de tout serveur configuré, et le remplacer par les 3 serveurs de temps (très fiables) du PTB allemand. Code Block |
---|
# Remplacez tous les serveurs existants sed -i -e "s / ^ server / # server /" /etc/chrony/chrony.conf # Remplacez le paramètre de pool sed -i -e "s / ^ pool / # pool /" / etc / chrony / chrony.conf # Ajouter des serveurs PTB cat << EOFF >> /etc/chrony/chrony.conf # Serveurs pour utiliser le serveur ptbtime1.ptb.de serveur iburst ptbtime2.ptb.de serveur iburst ptbtime3.ptb.de iburst EOFF # Activer Chrony systemctl activer chrony # Stop (juste au cas où il aurait été démarré), puis démarrer et obtenir le statut systemctl stop chrony systemctl start chrony |
Vérifier chrony Code Block |
---|
systemctl status chrony chronyc sources |
Paramètres bash:Le script suivant effectue les opérations suivantes: - Configurer un avertissement lors de l'utilisation de git en tant que root (sur root uniquement)
- Autoriser moins sur les fichiers compressés
Code Block |
---|
# root user cat <<'EOFF' >> ~/.bashrc [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" alias git='printf "It looks like you are trying to run GIT as ROOT.\nFor jtel installations, GIT should always be run from the jtel user.\nIf you really want to run git as root, you will need to access it directly, using /usr/bin/git for example.\n"' EOFF source ~/.bashrc # jtel user cat <<'EOFF' >> /home/jtel/.bashrc [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" EOFF |
Activer sarDebian 9 Code Block |
---|
# Enable stats sed -i 's/ENABLED="false"/ENABLED="true"/g' /etc/default/sysstat # Restart sysstat daemon service sysstat restart |
Debian 10+ Code Block |
---|
# Enable stats sed -i 's/ENABLED="false"/ENABLED="true"/g' /etc/default/sysstat # Restart sysstat daemon systemctl restart sysstat |
Warning |
---|
title | Avertissement - Debian 11 |
---|
| Dans Debian 11 Buster, un réglage doit être effectué dans le fichier de configuration /lib/systemd/system/anacron.timer et le deamon/service doit être rechargé. Sinon, les tâches cron quotidiennes seront exécutées à la valeur par défaut, qui est <07..23:30>. Code Block |
---|
vi /lib/systemd/system/anacron.timer <OnCalendar=*-*-* 04..23:30> systemctl daemon-reload systemctl restart anacron.timer systemctl status anacron.timer |
Info |
---|
Ceci ne doit être fait que sur les systèmes où anacron est installé. Si le fichier dans /lib/systemd/system/anacron.timer n'existe pas, alors il n'y a pas d'anacron et cette étape peut être ignorée. Dans ce cas, vérifiez les valeurs par défaut de cron.d dans le dossier /etc/cron.d |
|
Détecter l'hyperviseurVMWareLes outils sont installés comme suit : Code Block |
---|
apt-get -y install open-vm-tools |
Hyper-V Les outils sont installés comme suit : Code Block |
---|
apt-get -y install hyperv-daemons |
KVM Les outils sont installés comme suit : Code Block |
---|
apt-get -y install qemu-guest-agent |
Autres hyperviseurs Consultez le fabricant pour plus de détails. RedémarrerRedémarrez pour charger le nouveau noyau si un a été téléchargé et assurez-vous que les outils invités fonctionnent correctement. Serveur proxyServeur proxySi un serveur proxy est utilisé, les commandes suivantes configureront le serveur proxy pour root et l'utilisateur jtel. Les 5 premières lignes doivent être modifiées. Code Block |
---|
PROXY_USERNAME= PROXY_PASSWORD= PROXY_SERVER=proxy.example.de PROXY_PORT=3128 PROXY_EXCEPTIONS=.example.de,.local,10. if [ -n "$PROXY_USERNAME" ] && [ -n "$PROXY_PASSWORD" ] then PROXY="http://$USERNAME:$PASSWORD@$PROXY_SERVER:$PROXY_PORT" elif [ -n "$PROXY_USERNAME" ] then PROXY="http://$USERNAME@$PROXY_SERVER:$PROXY_PORT" else PROXY="http://$PROXY_SERVER:$PROXY_PORT" fi cat <<EOFF >> ~/.bashrc export ALL_PROXY=$PROXY export HTTP_PROXY=$PROXY export HTTPS_PROXY=$PROXY export FTP_PROXY=$PROXY export RSYNC_PROXY=$PROXY export http_proxy=$PROXY export https_proxy=$PROXY export ftp_proxy=$PROXY export rsync_proxy=$PROXY export NO_PROXY=$PROXY_EXCEPTIONS EOFF cat <<EOFF >> /home/jtel/.bashrc export ALL_PROXY=$PROXY export HTTP_PROXY=$PROXY export HTTPS_PROXY=$PROXY export FTP_PROXY=$PROXY export RSYNC_PROXY=$PROXY export http_proxy=$PROXY export https_proxy=$PROXY export ftp_proxy=$PROXY export rsync_proxy=$PROXY export NO_PROXY=$PROXY_EXCEPTIONS EOFF source ~/.bashrc |
C |