when you try to log via SSH to a machine that has changed the key, you get something like that
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! Someone could be eavesdropping on you right now (man-in-the-middle attack)! It is also possible that the RSA host key has just been changed. The fingerprint for the RSA key sent by the remote host is ..........
In order to reset the saved identification of the machine, run:
ssh-keygen -R <ip>
Now you can log again via SSH.
cp -a /source/folder /destination/folder
rsync -arPvH /source/folder root@IP:/destination/folder
tar cvfz archive.tar.gz /path-to folder-to-copy
cd /path-to-the folder where the archive is to extract tar xvfz archive.tar.gz
Si il y a des problèmes mkstemp au niveau des permissions, il faut “no-perms”:
# rsync -avz --no-perms --delete --progress root@machine.domain.tld:/dossier/de/source/ dossier_de_destination
Autre commande qui permet les interruptions et reprises de synchronisation:
# rsync -avh --progress --partial --append /source/folder root@IP:/destination/folder
sudo dd if=/dev/sdX of=/home/user/cdrom.iso bs=2048 conv=notrunc
This is particularly needed to install drivers or to update a bios. Source
bzip2 -d FreeDOS-1.1-USB-Boot.img.bz2
# dd if=FreeDOS-1.1-USB-Boot.img of=/dev/sdf
# mount /dev/sdf1 /mount/point
#cp BIOS_UPDATE.EXE /mount/point
My preferred solution is named “easy2boot”. The explanations for installation and use are for example here http://la-vache-libre.org/creer-une-cle-usb-multi-boot-en-6-etapes-avec-easy2boot-tuto/ in french.
sudo apt-get remove linux-headers-2.6.32-67 linux-headers-2.6.32-67-generic linux-image-2.6.32-67-generic --purge
package-cleanup --oldkernels -count=2
When Mate doesn't display correctly its panel(the top bar with “applications”, “places” and “system”), enter in a terminal to force Mate to regenerate the panel:
$ killall mate-panel
dd if=/dev/zero of=/dev/sdX bs=512 count=1
sdX or hdX or vdX or… = your disk!
With the utility “Smartmontool”:
sudo smartctl -H -i /dev/sdX
sudo smartctl -a /dev/sdX
sudo smartctl -t short /dev/sdX
sudo smartctl -t long /dev/sdX
sudo smartctl -l selftest /dev/sdX
sudo smartctl -q errorsonly -H -l selftest /dev/sdX
Recognizing which drive is “sdX” get getting the serial number:
hdparm -i /dev/sdX | grep -i serial
“lshw” or “dmidecode” or “hardinfo” in graphical mode
http://php.net/manual/en/function.phpinfo.php
https://gestion.rapide.net/knowledgebase/33/Comment-creer-un-fichier-PHPINFO.html
$ df -hT Sys. de fichiers Type Taille Utilisé Dispo Uti% Monté sur devtmpfs devtmpfs 3,9G 0 3,9G 0% /dev tmpfs tmpfs 4,0G 4,0K 4,0G 1% /dev/shm tmpfs tmpfs 4,0G 1,8M 4,0G 1% /run tmpfs tmpfs 4,0G 0 4,0G 0% /sys/fs/cgroup /dev/sda7 xfs 25G 17G 7,5G 70% / tmpfs tmpfs 4,0G 32K 4,0G 1% /tmp /dev/sda5 xfs 20G 12G 7,9G 60% /home //Server_samba/shared_folder1 cifs 10G 8,2G 1,8G 82% /mount/point
$ free -t total used free shared buffers cached Mem: 2058028 1906956 151072 0 212940 764968 -/+ buffers/cache: 929048 1128980 Swap: 4104504 500 4104004 Total: 6162532 1907456 4255076
# service --status-all
“top” or “htop”
du -sh
Use the program called “metamorphose”.
For files and folders.
$ find the_folder_to_set_permissions/ -type d -exec chmod 750 {} \; $ find the_folder_to_set_permissions/ -type f -exec chmod 640 {} \;
Useful for manually installed web application.
yum (or dnf) provides "the_name_of_the_missing_library"
will give which package must be installed to solve the missing dependency.
MSDOS partition tables are OK for partitions smaller than 2TB. Larger partitions are automatically “cut” by 2TB.
For larger partitions, use “parted” instead of “fdisk” and set the type “GPT” for the partition type.
The alignment of the partitions is a little bit tricky with parted.
Following allows the creation of a partition on the whole disk:
# parted /dev/sdX (parted) mkpart primary ext4 0% 100%
Pour renommer des fichiers en masse: utiliser gprename
Dispo sous Ubuntu 18.
$ ssh-copy-id -i ~USER_TO_CONNECT/.ssh/id_rsa.pub root@192.168.xxx.xxx
$ ssh -i /path/of/the/key.rsa user@IP_of_remote_host
to create a symbolic links:
ln -s /path/of/the/source /path/of/the/link
Use “iperf” or “iperf3” https://doc.ubuntu-fr.org/iperf
Visudo is used to edit and modify /etc/sudoers for example.
source: http://stackoverflow.com/questions/12736351/exit-save-edit-to-sudoers-file-putty-ssh
:wq
to save and press enter.
You should now be back at bash.
Now you can press ctrl + D to exit the session if you wish.
yum –exclude=name_of_package* update
cat /etc/passwd
or
getent passwd
groups the_user
cat /etc/group
adduser the_user #for complete adding (password + /home folder etc...) or useradd #more simply
addgroup the_goup
userdel the_user
Delete all snapshots of dataset “DATASET”:
# zfs list -H -t snapshot | grep "DATASET" | cut -f 1 | xargs -n 1 zfs destroy -r