Skip to main content

Разное

Установка sudo

apt-get install sudo
usermod -aG sudo username

Шаблон /etc/network/interfaces

allow-hotplug enp0s3
iface enp0s3 inet static
address 192.168.1.10
gateway 192.168.1.1
netmask 255.255.255.0

Узнать текущий dhcp сервер:

sudo dhclient -v

Оставить только один шлюз по умолчанию при двух серверах dhcp

cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug enp0s3
iface enp0s3 inet dhcp
    post-up ip route add default via $(ip route | grep 'default via' | awk '{print $3}') dev enp0s3 2>/dev/null || true

allow-hotplug enp0s8
iface enp0s8 inet dhcp
    post-up ip route add 192.168.0.0/16 via 192.168.51.1
    post-up ip route del default dev enp0s8 2>/dev/null || true

 

Копирование файла по scp 

scp /home/sergey/file sergey@192.168.1.10:~/
scp sergey@192.168.1.10:~/file ~/

Закодировать строку в Base64 

echo "My string" | base64