Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Content imported from a Scroll Translations translation file.
Sv translation
languageen

Change to root

Code Block
su -

Update and Install Packages

Code Block
apt-get -y update
apt-get -y upgrade
apt-get -y install sudo vim unzip rsync sysstat cifs-utils nmap tcpdump tmux virt-what chrony smbclient ufw curl net-tools

Configure VIM

VIM detects the mouse, and copy pasting between two terminal windows is annoying because of this. Disable this as follows for root and jtel:

Code Block
cat << EOFF >> ~/.vimrc
set mouse-=a
EOFF

cp ~/.vimrc /home/jtel
chown jtel:jtel /home/jtel/.vimrc

Configure Sudo for jtel User

The following command adds the jtel user to the sudo group:

Code Block
adduser jtel sudo

Setup the Firewall

The following commands enable the firewall and allow ssh.

Code Block
ufw --force reset
ufw --force default deny incoming
ufw --force default allow outgoing
ufw allow ssh
ufw --force enable

Setup chrony

The following commands install chrony and modify the basic chrony.conf file to remove usage of the default pool and any configured servers, and replace this with the 3 (very reliable) time servers from the German PTB.

Code Block
# Replace all existing servers
sed -i -e "s/^server /# server /" /etc/chrony/chrony.conf
# Replace pool setting
sed -i -e "s/^pool /# pool /" /etc/chrony/chrony.conf
# Add PTB Servers
cat << EOFF >> /etc/chrony/chrony.conf

# Servers to use
server ptbtime1.ptb.de iburst
server ptbtime2.ptb.de iburst
server ptbtime3.ptb.de iburst
EOFF

# Enable Chrony
systemctl enable chrony

# Stop (just in case it was started), then start and get status
systemctl stop chrony
systemctl start chrony

Check chrony

Code Block
systemctl status chrony
chronyc sources

Bash Settings

The following script does the following:

  • Setup a warning when using git as root (on root only)
  • Allow for less on zipped files
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

Detect the Hypervisor

Code Block
virt-what

VMWare

The tools are installed as follows:

Code Block
apt-get -y install open-vm-tools

Hyper-V

The tools are installed as follows:

Code Block
apt-get -y install hyperv-daemons

KVM

The tools are installed as follows:

Code Block
apt-get -y install qemu-guest-agent

Other Hypervisors

Consult the manufacturer for further detals.

Reboot

Reboot to load the new kernel if one was downloaded and make sure the guest tools are running OK.

Sv translation
languagefr

Changer à root

Code Block
su -

Mise à jour et installation des paquets

Code Block
apt-get -y update apt-get -y upgrade apt-get -y install sudo vim unzip rsync sysstat cifs-utils nmap tcpdump tmux virt-what chrony smbclient ufw curl net-tools

Configurer VIM

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 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

Configurer Sudo pour l'utilisateur jtel

La commande suivante ajoute l'utilisateur jtel au groupe sudo :

Code Block
adduser jtel sudo

Configurer le pare-feu

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

Configurer chrony

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
# Replace all existing servers sed -i -e "s/^server /# server /" /etc/chrony/chrony.conf # Replace pool setting sed -i -e "s/^pool /# pool /" /etc/chrony/chrony.conf # Add PTB Servers cat << EOFF >> /etc/chrony/chrony.conf # Servers to use server ptbtime1.ptb.de iburst server ptbtime2.ptb.de iburst server ptbtime3.ptb.de iburst EOFF # Enable Chrony systemctl enable chrony # Stop (just in case it was started), then start and get status 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
<<'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

Détecter l'hyperviseur

Code Block
virt-what

VMWare

Les 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émarrer

Redémarrez pour charger le nouveau noyau si un a été téléchargé et assurez-vous que les outils invités fonctionnent correctement.