Як змонтувати Samba директорії по мережі в Ubuntu, Debian

Для того, щоб примонтувати директорію Samba на лікусі треба зробити наступні кроки:

Встановити пакет cifs-utils:

sudo apt install cifs-utils

Створити директорію, в яку будете монтувати:

sudo mkdir /media/share

Створити файл з параметрами доступу:

nano /root/.smbcredentials

Та додати туди логін та пароль до Самба шари:

username=smb_username
password=smb_password

Зробити файл тільки для читання для власника файлу:

chmod 400 /root/.smbcredentials

Змонтувати самба шару:

sudo mount -t cifs -o rw,vers=3.0,credentials=/root/.smbcredentials //192.168.1.10/share /media/share

Додати запис до /etc/fstab, щоб шара монтувалася автоматично при перезапуску комп’ютера/сервера:

//192.168.1.10/share /media/share cifs vers=3.0,credentials=/root/.smbcredentials

Ссилки:

  1. https://tecadmin.net/mounting-samba-share-on-ubuntu/

Edit kernel boot options with grubby

Grubby is a useful tool to change boot options on RHEL-based systems with grub2 since it is not preferable to manually edit config files for grub2 in RHEL8/9.

Messing with default kernel

To list all kernel menu entries, enter:

grubby --info=ALL
index=0
kernel="/boot/vmlinuz-4.18.0-372.9.1.el8.x86_64"
args="ro crashkernel=auto resume=/dev/mapper/rhel-swap rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet $tuned_params zswap.enabled=1"
root="/dev/mapper/rhel-root"
initrd="/boot/initramfs-4.18.0-372.9.1.el8.x86_64.img $tuned_initrd"
title="Red Hat Enterprise Linux (4.18.0-372.9.1.el8.x86_64) 8.6 (Ootpa)"
id="67db13ba8cdb420794ef3ee0a8313205-4.18.0-372.9.1.el8.x86_64"
index=1
kernel="/boot/vmlinuz-0-rescue-67db13ba8cdb420794ef3ee0a8313205"
args="ro crashkernel=auto resume=/dev/mapper/rhel-swap rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet"
root="/dev/mapper/rhel-root"
initrd="/boot/initramfs-0-rescue-67db13ba8cdb420794ef3ee0a8313205.img"
title="Red Hat Enterprise Linux (0-rescue-67db13ba8cdb420794ef3ee0a8313205) 8.6 (Ootpa)"
id="67db13ba8cdb420794ef3ee0a8313205-0-rescue"

To find out the file name of the default kernel, enter:

grubby --default-kernel
/boot/vmlinuz-4.18.0-372.9.1.el8.x86_64

To find out the index number of the default kernel, enter:

grubby --default-index
0

To change default kernel for booting:

grubby --set-default /boot/vmlinuz-4.18.0-372.9.1.el8.x86_64
grubby --set-default-index=0

Messing with kernel boot arguments

To add boot arguments to specific kernel:

grubby --args=console=ttyS0,115200 --update-kernel /boot/vmlinuz-4.18.0-372.9.1.el8.x86_64

To remove arguments:

grubby --remove-args="rhgb quiet" --update-kernel /boot/vmlinuz-4.18.0-372.9.1.el8.x86_64

Links:

  1. https://access.redhat.com/documentation/de-de/red_hat_enterprise_linux/8/html/managing_monitoring_and_updating_the_kernel/assembly_making-persistent-changes-to-the-grub-boot-loader_managing-monitoring-and-updating-the-kernel

Error ‘no hostkey alg’ while trying to connect via ssh fix

This error usually happens when old ssh client tries to connect to modern ssh server, with doesn’t support old RSA ciphers by default.

To fix this and be able to connect from old box, add to /etc/ssh/sshd_config on the server side following:

HostKeyAlgorithms +ssh-rsa
PubkeyAcceptedKeyTypes +ssh-rsa

It must be added before row:

Include /etc/ssh/sshd_config.d/*.conf

Otherwise, according to forums, it might not work.

After adding options restart ssh daemon (you won’t lose your current connection):

systemctl restart sshd

Links:

  1. https://unix.stackexchange.com/questions/679451/sshd-no-hostkey-alg-fixed-but-still-confused