Comandi Linux

  • Gnu.org_Builtin-Index
  • Learning.lpi.org/it
  • Tecmint.com
  • fr@internet-fr-casa2
  • nano .bash_history
  • nano .bash_aliases
  • sudo cat .pwd_ocm-web_scan
  • sudo cat .pwd_ocm-web_admin
  • sudo cat .pwd_internet3
  • sudo apt update && sudo apt upgrade
  • sudo apt autoremove
  • chmod 777 ocm.kdbx — sudo
  • chmod g+w * — sudo
  • chown root:root .pwd* — sudo
  • chown fr:fr gnote/ — sudo
  • crontab -e — sudo
  • df -a -h
  • distro-info -I
  • du -sk */ | sort -rn
  • du -hd 1
  • du -sh ./Documenti_FRANCESCO/ | sort -rn
  • hostname -a — sudo
  • fdisk -l /dev/sda — sudo
  • find . -type f -size +180M
  • free -h
  • fstab nano /etc/fstab
  • history | grep ssh
  • ip addr show
  • iptables -L -v
  • locate -b *.pdf | grep -i micro7
  • locate *.pdf 1M
  • locate *.pdf | grep -i francesco
  • locate *.pdf | grep 600
  • locate *fattur*.pdf | less
  • locate fstab
  • ll Scansioni_su_OCM-WEB/
  • ln -s [source-file-path] [symbolic-link-path] —– link simbolici
  • ln -sf testfile nuovo_apri_testfile
  • ls -la /home/ocm | grep pwd
  • ls -l ~/.local/share/
  • ls -l ~/.local/share/Trash/files
  • lsb_release -a
  • lscpu
  • lshw -C network
  • mkdir prova
  • mount -a
  • pwd
  • reboot
  • rm -rf /home/fr/.local/share/Trash/files/* sudo
  • devdev.it/comando-rsync-esempi
  • rsync -avrzh –delete /media/fr/Elements/BK/ /home/fr/Documenti/Backup/BK
  • rsync -zvrah /media/fr/Elements/BK/ /home/fr/Documenti/Backup/BK
  • rsync -zvrah ./media/fr/Elements/BK/ ./home/fr/Documenti/Backup/BK
  • sudo rsync –delete -av ./home/fr/Scaricati/FOTO/TO1 ./home/fr/Scaricati/FOTO/TO2
  • ———————————————————————————-
    451 sudo rsync –delete -zvrah home/fr/Documenti ./media/fr/Volume/FRANCESCO_INTERNET_CASA
  • 452 sudo rsync –delete -zvrah ome/fr/Documenti ./media/fr/Volume/FRANCESCO_INTERNET_CASA
  • 454 sudo rsync –delete -zvrah home/fr/Documenti ./media/fr/Volume/FRANCESCO_INTERNET_CASA
  • 455 sudo rsync –delete -zvrahE home/fr/Documenti ./media/fr/Volume/FRANCESCO_INTERNET_CASA
  • 458 sudo rsync –delete -zvrahE home/fr/Documenti ./media/fr/Volume/FRANCESCO_INTERNET_CASA
  • 459 df -h
  • 460 fdisk -l
  • 461 sudo fdisk -l
  • 462 sudo rsync –delete -zvrah home/fr/Documenti ./media/fr/Volume/FRANCESCO_INTERNET_CASA
  • ———————————————————————————-
  • scp ocm@internet-mg:/home/ocm/.thunderbird/ocm2022.admin/* ocm2022.admin/
  • scp ocm@192.168.2.106:/home/ocm/.thunderbird/ocm2020.admin/* ocm2020.admin/
  • scp fr@192.168.2.111:/home/fr/.pwd*
  • shutdown -r now
  • smbpasswd -a ocm
  • sudo sync; echo 3 > /proc/sys/vm/drop_caches
  • sudo  updatedb
  • tar Compress an entire directory by running tar -zcvf file. tar. gz /path/to/dir/command in Linux. To compress a single file by running tar -zcvf file.28
  • https://www.cyberciti.biz/faq/how-to-tar-a-file-in-linux-using-command
  • top
  • shred
  • shred -vfz /dev/sde —- sudo
  • rm‌ ‌-rf‌ ‌~/.local/share/Trash/files/*‌ —- sudo
  • umount -a
  • updatedb
  • w – user
  • wget –no-directories –content-disposition -e robots=off -*.pdf -r http://www.ipritalia.com/
  • *******************************************************
  • @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  • @ 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 a host key has just been changed.
  • The fingerprint for the ED25519 key sent by the remote host is
  • SHA256:UyLdaQ1FQsDeH0De3Pv6B68zHDw4DRxwWgEjtlYlkYc.
  • Please contact your system administrator.
  • Add correct host key in /home/fr/.ssh/known_hosts to get rid of this message.
  • Offending ECDSA key in /home/fr/.ssh/known_hosts:7
  • remove with:
  • ssh-keygen -f “/home/fr/.ssh/known_hosts” -R “192.168.2.40”
  • Host key for 192.168.2.40 has changed and you have requested strict checking.
  • Host key verification failed.
  • @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

Disco

  • sudo du -hd 1 ./Documenti_FRANCESCO/  | sort -rn
  • sudo pvs –all
  • lsblk

Rete

  • network:///
  • ping 51.178.19.76
  • ping www.ditecautomations.com
  • nano /etc/fstab

Samba

Ssh

  • ls ~/.ssh
  • ssh -v host locale
  • sudo systemctl status ssh
  • sudo apt install openssh-server
  • sudo nano /etc/ssh/sshd_config
  • START
  • sudo /etc/init.d/ssh start
  • sudo service ssh start
  • sudo systemctl start ssh
  • STOP
  • sudo /etc/init.d/ssh stop
  • sudo service ssh stop
  • sudo systemctl stop ssh
  • RESTART
  • sudo /etc/init.d/ssh restart
  • sudo service ssh restart
  • sudo systemctl restart ssh
  • STATUS
  • sudo /etc/init.d/ssh status
  • sudo service ssh status
  • sudo systemctl status ssh
  • ssh-keygen -f “/home/fr/.ssh/known_hosts” -R “192.168.2.40”
  • ———————————————————————————
  • https://turbolab.it/server-1224/guida-come-disattivare-login-ssh-password-ubuntu-server-linux-654
  • https://kb.iu.edu/d/aews
  • https://docs.rockylinux.org/it/guides/security/ssh_public_private_keys/
  • https://guide.debianizzati.org/index.php/OpenSSH:_file_di_configurazione
  • ———————————————————————————
  • Raspberrypi.com_SSH Remote-access
  • —————-raspy
  • hostname -I
  • nmcli device show (Network Manager)
  • ping raspberrypi.local supports multicast DNS)
  • sudo nmap -sn 192.168.1.0/24
  • sudo touch /boot/firmware/ssh
  • sudo reboot
  • Configure SSH without a password
  • ~/.ssh/id_rsa.pub
  • ls ~/.ssh (per vedere se ci sono le chiavi private e epubbliche)
  • ssh-keygen
  • Aggiungi la chiave SSH al tuo elenco di identità SSH
  • eval “$(ssh-agent -s)”
  • ssh-add ~/.ssh/id_rsa
  • Copia una chiave pubblica sul tuo Raspberry Pi
  • ssh-copy-id @
  • Copia manualmente una chiave pubblica sul tuo Raspberry Pi SERVER
  • su server
  • mkdir .ssh
  • chmod 700 .ssh
  • Sul tuo computer abituale , usa scpper copiare la tua chiave pubblica in un file denominato .ssh/authorized_keyssul tuo Raspberry Pi:
  • scp .ssh/id_rsa.pub @:.ssh/authorized_keys
  • Il comando sopra presuppone che tu non abbia mai autorizzato alcuna chiave per accedere al tuo Raspberry Pi. Se hai precedentemente aggiunto almeno una chiave, dovresti invece aggiungere una nuova riga contenente la chiave pubblica alla fine del authorized_keysfile per preservare le tue chiavi esistenti.
  • Quando richiesto, inserisci la password del tuo account utente sul Raspberry Pi.
  • Quindi, sul tuo Raspberry Pi , configura i permessi per il authorized_keysfile:
  • chmod 644 .ssh/authorized_keys
  • Ora puoi connetterti al tuo Raspberry Pi senza inserire una password.
  • —————-raspy
  • ———————————————————————————
  • Wiki.debian.org_it_SSH
  • apt install openssh-client
  • apt install openssh-server
  • I principali file di configurazione sono nella directory /etc/ssh :
  • ssh_config : file di configurazione del client
  • sshd_config : file di configurazione del server
  • A partire da Bullseye, i file di configurazione sono letti anche dalle seguenti sottodirectory:
  • /etc/ssh/ssh_config.d/*.conf : file di configurazione del client
  • /etc/ssh/sshd_config.d/*.conf : file di configurazione del serve
  • Rigenerare le chiavi dell’host
  • rm /etc/ssh/ssh_host_*
  • dpkg-reconfigure openssh-server
  • Per generare la chiave si usa il programma ssh-keygen
  • ssh-keygen -t rsa ( in ~/.ssh – viene richiesta una passphrase)
  • Si può copiare la propria chiave pubblica su un host remoto usando il comando ssh-copy-id
  • ssh-copy-id -i ~/.ssh/id_rsa.pub $remote_user@$remote_host
  • Ora ci si può connettere semplicemente all’host remoto e verrà richiesta la passphase
  • SERVER
  • service ssh restart
  • sshd -T | sort
  • ———————————————————————————
  • Ubuntu.com_Community_SSH
  • /etc/ssh/ssh_config
  • env | grep -i ssh (# Controllare se ssh-agent e’ in esecuzione)
  • ssh -v localhost (verifica se ssh gira in locale)
  • ps -A | grep sshd (verifica il demone se gira)
  • Ubuntu.com_service-openssh
  • Ubuntu.com_SSH/OpenSSH/Configuring
  • https://wiki.ubuntu-it.org/InternetRete/DesktopRemoto/OpenSsh

Wiki.ubuntu-it.org/InternetRete/DesktopRemoto/OpenSsh

Nano

  • sudo nano /etc/cups/snmp.conf
  • sudo nano /etc/modprobe.d/blacklist.conf
  • sudo nano .pwd_ocm-web
  • sudo nano .pwd_ocm-web_scan
  • sudo nano .ssh/authorized_keys
  • sudo nano .ssh/known_hosts
  • sudo nano /etc/fstab
  • sudo nano /etc/hosts
  • sudo nano /etc/named.
  • sudo nano /etc/named.conf
  • sudo nano /etc/named.nslookup ocmflex.com
  • sudo nano /etc/network/interfaces
  • sudo nano /etc/NetworkManager/conf.d/
  • sudo nano /etc/samba/smb.conf
  • sudo nano /etc/samba/smb.conf
  • sudo nano /etc/ssh/sshd_config
  • sudo nano /etc/ssh/sshd_config
  • sudo nano authorized_keys
  • sudo nano profiles.ini

Cat

sudo cat /etc/fstab
sudo cat /etc/fstab
sudo cat /etc/fstab | grep .pwd
sudo cat /etc/named.conf
sudo cat /etc/NetworkManager/conf.d/
sudo cat /etc/passwd
sudo cat /etc/passwd
sudo cat /etc/passwd | grep scan
sudo cat /etc/resolv.conf
sudo cat /etc/samba/smb.conf
sudo cat /etc/ssh/ssh_config
sudo cat /etc/ssh/ssh_config.d/*.conf
sudo cat /root/.ssh/id_rsa.pub
sudo cat syslog | grep a
sudo cat syslog | grep cub

File Configurazione

  • sudo nano /etc/resolv.conf ( 9 )
  • ————
  • nameserver 127.0.0.53
  • options edns0 trust-ad
  • search ocmflex.local
  • ————

Script

Esempio

  • chmod a+x prova01_2024.sh (to let everyone run your script)
  • chmod u+x prova01_2024.sh (to let yourself but no-one else run it)

Link

Link

  • rsync -zvrah home/fr/Scaricati/LUCA /home/fr/Scaricati/prova
  • tar -zcvf prova2024.tar.gz /home/fr/Scaricati/prova
  • prova2024.tar.gz
  • Removing directories
  • rm -r directory-name
  • rmdir directory-name
  • ps2pdf
  • create a PDF
  • w – who else is using the computer