Linux
###--- Gott sei Dank, ich bin weg vom Fenster ---###
Inhaltsverzeichnis
- 1 Starten mit Linux
- 2 My favourite Linux Software
- 3 Zovis Install String
- 4 FAQ
- 4.1 gvfsd-admin daemon authentication Window not disappear
- 4.2 Grosse Files generieren
- 4.3 SSSD Active Directory integration von Linux
- 4.4 Update Upgrade 'n Stuff
- 4.5 Zertifikate Certificates
- 4.6 Automatisation
- 4.7 Docker
- 4.8 Prozess Management
- 4.9 Loging
- 4.10 Networking
- 4.11 Proxy
- 4.12 Firewall
- 4.13 Security
- 4.14 Debug
- 4.15 User
- 4.16 SAN/FC/HBA/Disc
- 4.17 Passwörter
- 4.18 Bootstik
- 4.19 SAMBA
- 4.20 VLAN hinzufügen
- 4.21 Startablauf
- 4.22 Rechner einmal täglich booten
- 4.23 IPMI
- 4.24 Allgemein
- 4.25 Netzwerk zügs
- 4.26 Sonstiges
- 4.27 RPM to DEB - alien
- 4.28 Root rechte
- 4.29 Mount / Disk / Partitionen
- 4.29.1 SMART Checks
- 4.29.2 fstab
- 4.29.3 Disk
- 4.29.4 VM Disk / Volume vergrössern erweitern
- 4.29.5 LVM Disk / Volume vergrössern
- 4.29.6 SWAP Vergrössern in RHEL8
- 4.29.7 SWAP Vergrössern in RHEL9
- 4.29.8 iso mounten
- 4.29.9 Mount Error
- 4.29.10 Partitionen beim Start mounten
- 4.29.11 CIFS
- 4.29.12 NFS
- 4.29.13 fstab ohne reboot neu einlesen
- 4.29.14 Mount - GUI Tools
- 4.30 Daten kopieren/ verschieben
- 4.31 Diskspace full
- 4.32 Suchen / und Löschen
- 4.33 Netzwerkkonfiguration
- 4.34 DVD Codecs und co.
- 5 Software
- 5.1 Webmin
- 5.2 Probleme mit VMWare Server 2.0.* und VMWare Konsole via Firefox
- 5.3 SAMBA
- 5.4 MAC Adressen an ein IF Name binden
- 5.5 Cron
- 5.6 Bootloader / Grub
- 5.7 monitorix
- 5.8 Conky Systemmonitor
- 5.9 WC Word Count
- 5.10 Host SMBus controller bus not enabled
- 5.11 SNMP
- 5.12 File Explorer
- 5.13 Root Zertifikat inportieren
- 5.14 Services Daemons
- 5.15 CAD
- 5.16 Autostart Tablet
- 6 NTP
- 7 AppImage
- 8 CENTOS Update error
- 9 Links
Starten mit Linux
Sehr gute einführung in die Shell [1]
My favourite Linux Software
Linux SW (Ubuntu)
PM = Paket Manager
zur Apt-get Linuxtips.LinuxSWListe SWListe
Allgemeines
- https://www.zerotier.com/ - Mesh VPN Tool - noch testen
- Cockpit https://cockpit-project.org/ - Cockpit is a web-based graphical interface for servers - noch testen
- Kate - noch testen evt ein guter notepad++ ersatz
- tasksel → PM Quick-Installtool für LAMP, DNS Server, und noch vieles mehr Tasksel Ubuntu Doc. - Guideline
- Ubuntu Tweak → GetDeb
- Wireshark → PM
- gnome-device-manager → PM
- Umit Network Scanner → PM
- gtkpod - iPod manager → PM
- Hipo - iPod manager → PM
- Brennproggies
- K3b, (evt auch GnomeBaker) → PM - Brennproggies
- Brasero PM
- DiscWrapper LabelSW die mit 4L-gui funzt
- Shutter → PM - Printscreens und mehr
- MountManager → PM
- CompizConfig → PM
- Desktop Drapes
- ( Tor & Privoxy )
- Sweet Home 3D → SW Home
- Simple Labeler für LightScribe
- grsync - Data Sync Mgmt. and
- pyNeighborhood → PM (GUI - kleiner Mountmanager)
- Music Applet → PM
- Wallpaper Tray → PM - Allpet
- minicopier - SuperCopier clone
- oder:
- UltraCopier - [2] gefällt mir schon fast besser... =)
- keepass 2 - Password Safe Tool - http://keepass.info - Install Ubuntu - FTP online DB
- Wammu - Handy SW → PM
- gMobileMedia - Handy Datamanager SW → PM
- GCstar Collections Manager - → PM - Movie list export to html → https://launchpad.net/~gcstar/+archive/ppa für die aktuellere Version
- Wuala - Net-Space
- gkrellm → PM - Echtzeit Monitoring Tool
- VirtualBox → neuste Version und auch das dazu passende VM VirtualBox Extension Pack für USB2 Support siehe hier → USB Unterstützungsfehler siehe hier
- Kraft → KMU Finanz SW
- Visio clon - 1000mal besser als Visio & OpenSource -> https://draw.io
- Notepadqq - PM Notepad++ for Linux
Backup / Sync
- Unbedingt anschauen! https://syncthing.net/downloads/ kommt auch übers wan mit unterbrüchen klar.
- ReaR http://relax-and-recover.org/ BareMetal Desaster recovery tool
- neu: R1 Linux Snapshot http://www.r1soft.com/free-backup-tools
- Back in Time
- Komparator - Compair Folders and Data → PM
- Dar (noch anschauen)
- insync - great google drive sync tool - evt. bagaren
- fwbackups Linux and Windoof Backups (to check) old source!
- QT-Fsarchiver - GUI Backup und Clone Tool für Partitionen - nice für ubuntu isostick https://wiki.ubuntuusers.de/qt-fsarchiver/
- HDDs Blockweise Sichern - RescueZilla
- Testen: KUP KDE Backup Tool
- Veeam ist spitze
- Noch testen:
- Duplicati - mit GUI und Cloud zugang, Auch für WIN und Mac. DB inst local. Sieht toll aus
- Pika Backup - Mit GUI. Sieht gut aus
BackUpen mit tarball -> tar.gz
tar -cjvf /pfad/zum/sicherigsmedium/sicherig-vom-2008-12-22.tar.bz2
restoren mit..
tar -xpvf sicherig-vom-2008-12-22.tar.bz2
Recover Forensic
- rdd - Ein forensisches Kopierprogramm - PM
- ddrescue - Kopiert Daten von einer Datei oder einem Block-Gerät zu einem Anderen - PM
- RECOVER in UBUNTU → help.ubuntu.com
Sichern und Wiederherstellen einer Partition
- DD Wikipedia
Von einer Partition lässt sich mit dd eine exakte Kopie als normale Image-Datei im vorhanden Dateisystem ablegen. Zweckmässigerweise ist die Gerätedatei der Partition nicht eingehängt, damit ein versehentliches Vertauschen von if= und of= nicht zu Datenverlust führen kann.
dd if=/dev/sda1 of=/tmp/sda1_image
Danach kann bspw. ein „Undelete“ (undelete) auf einem ext2/ext3/ext4-Dateissystem mit debugfs -w /dev/sda1 versucht werden. Zum Wiederherstellen des Ausgangszustandes vertauscht man Ein- und Ausgabedatei:
dd of=/dev/sda1 if=/tmp/sda1_image
Datenträger unlesbar machen
Infos über das Löschen von HDDs
Unwiderrufliches Löschen einer ganzen Festplatte /dev/sda einschließlich aller Partitionsinformationen mit /dev/urandom unter GNU/Linux:
dd if=/dev/urandom of=/dev/sda
Löschen einer SSD
Siehe http://www.pcwelt.de/ratgeber/Datensicherheit-6581465.html
BleachBit --> PM
Gnome Disk
DBAN - Linux Distri auf iso
Audio
- Rhythmbox → Aktueller installieren
sudo add-apt-repository ppa:webupd8team/rhythmbox sudo apt-get update sudo apt-get upgrade
- VLC → PM
- Audacity - mp3 bearbeiten - → PM
- Calf → PM
- LV2 → PM
- Ardour → PM / → http://ardour.org - Digitale Audio Workstation
- Guitarix -; gutarren Verstärker SW
- gstreamer0.10-ffmpeg → GStreamer-Erweiterungen aus der »bad«-Sammlung → PM
- gstreamer0.10-plugins-bad → FFmpeg-Erweiterung für GStreamer
- TuxGuitar und Timidity → Gitarren SW
- Mixx → DJ SW ab vers 1.9 brauchbar
- PulseAudio Lautschtärke Regler → PM - Mixer um das Lineout aufnehmen zu können =)
- MusE - PM - MIDI/Audio-Sequenzer und -Bearbeitungsprogramm
- Testen: SpotRec Um spotify Aufnamen zu machen
Video
- MakeMKV - MKV erzeugen PM - https://forum.makemkv.com/forum/viewtopic.php?f=5&t=1053 for the beta key
- DVD abspielen - siehe Medibuntu
- DVD95 - Ganz easy Sicherheitskopien erstellen → PM
- DeVeDe - Kuuler convertierer - DVD → PM\\ nice! Können direkt DVDs ab MKVs erstellt werden.
- PiTiVi → Video schneide Progi → einstellung für typo3-flash: format:FLV, grösse: 400x300, skalieren: 100%, 25fps, codec: x264enc, audio: l.a.m.e. mp3\\
- OpenShot Video-Editor → siehe hier
- Kdenlive - Linux Video Editor - "Easy to use" und kann sehr viel
- avidemux MKVs trennen - Sehr geil und easy - http://avidemux.sourceforge.net/
- Motion - kuules Cam stream and motion- detection Tool
- Noch testen: Davinci Resolve
- Noch testen: Multimediakonverter Mystiq - https://mystiqapp.com/
Bild
- KColorChooser → PM - oder Gcolor2 → PM
- Gimp oder/und Krita → PM - Grafik Tools
- Inkscape → PM
- nautilus-image-converter → PM → Bilder im Nautilus ändern. Damit bekommst du im Kontextmenü von Bildern die Option die Größe von Bilder zu ändern usw.
TinTii - Den Bilern Farbe entnehmen oder verleihen
Screenshot
- Geiles Tool Flameshot → PM
sudo apt install flameshot
- Shutter - Umständlich aber kann viel
Games
- Nexuiz → PM
- OpenArena → PM
- AlienArena → PM
- Chromium B.S.U. → PM
- Torcs → PM
- Blobby Volley 2
- Noch Testen: Unforeseen Incidents
Fonts
- ttf-aenigma → PM
- ubuntustudio-font-meta → PM
- ttf-aenigma → PM
RDP, TeamViewer, Nomachine,... Remote Zugriff
- Tolles Tool für alle OS
TeamViewer, Nomachine,.. unterstützen kein Wayland beim Anmeldebildschirm. deshalb auf XOrg wechseln.
Ubuntu 18.04 wayland Fehler. It seems that, while not on user desktop which uses Xorg, the gdm login manager is using Wayland. Unfortunately our video grabbing method for Wayland does not work on virtual machines yet.
Right now the only way for NoMachine to work properly is to disable Wayland on login window screen.
For Ubuntu and gdm this would be editing
/etc/gdm3/custom.conf
file and adding or uncommenting the line:
WaylandEnable=false
- Remmina → PM (geiles Tool!) Autostart: remmina -i (startet so als Trayicon)
- (Gnome-RDP → PM - Hilfe und Infos)
Remote Administration
- Cockpit - https://cockpit-project.org
- Ajenti - http://ajenti.org/ nur für einzelne PC - Keine Zentrale verwaltung
- Webmin - http://www.webmin.com
Hardware
- indicator-multiload:i386 -> PK - Ein Systemlast-Indikator, der Graphen zu CPU, RAM und Swap- Speicherverbrauch sowie zur Netzwerkauslastung anzeigen kann.
- xsensores
- Screenlets(Desktop Widgets) Fixed For Ubuntu 16.04, Available In PPA
- Lshw Hardware anzeigen - noch checken
- sudo hardinfo in PM - Grafische Hardware Anzeige
Fun
- Docky → PM - Dockmanager
ToDo
- Minino Linux Distribution - für alte HW page
- Hugin - Panorama SW
- Bombono DVD → PM
- zoneminder - überwachen von bereichen eines vieoblockfeldes → PM
- Photivo - RAW-Bild editor der mit GIMP zuammen arbeitet → Website
- 4Pane - Kuuler Dateimanager - WEB, Ubuntu inst.
- PhotoFilmStrip PhotoFilmStrip erstellt Videoclips aus Bildern
- Babelpod → Ipod SW alternative zu iTunes ???
- video schneiden mit LiVES
- KMyMony Finanztool
- zsys - zfs mgmt tool
- Gamehub - sudo add-apt-repository ppa:tkashkin/gamehub && sudo apt update && sudo apt install com.github.tkashkin.gamehub
- Digikam - Fototool mächtig
- Genymotion - bringt ein Android Gerät auf den Linux Desktop.
- DeConz - Heimautomatisation auf Linux
- DSVPN - Dead simple VPN
- DNS Monitor - github.com/axllent/dnsmonitor
- SFTP Server - SFTP go 0.9.3
- Kubernetes - Container Mgmt
- Time 4 Popcorn - Time 4 Popcorn is a simple open source torrent streaming application that uses the BitTorrent network to download and then share contemporary, high quality movies and TV. http://sysads.co.uk/2014/05/16/install-time-4-popcorn-3-1-ubuntu-14-04-13-10/
- Check SW - hypnotix tv sw
Zovis Install String
Home:
sudo apt-get install wireshark umit k3b shutter wammu vlc audacity dvd95 devede kcolorchooser gimp openarena alien-arena ttf-aenigma ubuntustudio-font-meta lame gstreamer0.10-plugins-ugly gstreamer0.10-plugins-ugly-multiverse python-mutagen python-notify cifs-utils nfs-common gparted gstreamer0.10-ffmpeg gstreamer0.10-plugins-bad p7zip-full
for Work:
sudo apt-get install remmina wireshark umit k3b shutter kcolorchooser gimp ttf-aenigma ubuntustudio-font-meta cifs-utils nfs-common gparted p7zip-full
FAQ
gvfsd-admin daemon authentication Window not disappear
I managed to remove it by pressing the Alt + F2, type "r" in the command box, and press enter. GNOME should restart and the window will disappear.
Grosse Files generieren
fallocate -l 100G filename
SSSD Active Directory integration von Linux
Infos
https://www.freeipa.org/images/c/cc/FreeIPA33-sssd-access-control.pdf
I solved this problem by adding the sudo group I'd created in AD to the /etc/polkit-1/localauthority.conf.d/51-ubuntu-admin.conf config file.
In my case the AD group to allow sudo in the terminal was EngineeringSudo, so my 51-ubuntu-admin.conf file looks like this now.
[Configuration] AdminIdentities=unix-group:sudo;unix-group:admin;unix-group:EngineeringSudo
This works by making your AD sudo group an "Administrator" as far as PolKit is concerned.
Gute Anleitung von hier
https://ubuntu.com/server/docs/service-sssd
Installationsanleitung
Install the following packages:
sudo apt install sssd-ad sssd-tools realmd adcli
Join the domain
We will use the realm command, from the realmd package, to join the domain and create the sssd configuration.
Let’s verify the domain is discoverable via DNS:
$ sudo realm -v discover ad1.example.com * Resolving: _ldap._tcp.ad1.example.com * Performing LDAP DSE lookup on: 10.51.0.5 * Successfully discovered: ad1.example.com ad1.example.com type: kerberos realm-name: AD1.EXAMPLE.COM domain-name: ad1.example.com configured: no server-software: active-directory client-software: sssd required-package: sssd-tools required-package: sssd required-package: libnss-sss required-package: libpam-sss required-package: adcli required-package: samba-common-bin
This performs several checks and determines the best software stack to use with sssd. sssd can install the missing packages via packagekit, but we installed them already previously.
Now let’s join the domain:
sudo realm join corp.itsroot.biz -U neku1opr@CORP.ITSROOT.BIZ -v --computer-ou="OU=Linux,OU=Servers,OU=Systems,OU=Company,DC=corp,DC=itsroot,DC=biz" --automatic-id-mapping=yes
realm join corp.stemoag.ch -U neku1@CORP.STEMOAG.CH -v --computer-ou="OU=Linux,OU=Systems,DC=corp,DC=stemoag,DC=ch" --automatic-id-mapping=yes
root@pluto11:~# cat /etc/sssd/sssd.conf
[sssd] domains = corp.stemoag.ch config_file_version = 2 services = nss, pam, sudo [domain/corp.stemoag.ch] default_shell = /bin/bash krb5_store_password_if_offline = True cache_credentials = True krb5_realm = CORP.STEMOAG.CH realmd_tags = manages-system joined-with-samba id_provider = ad fallback_homedir = /home/%u ad_domain = corp.stemoag.ch use_fully_qualified_names = False ldap_id_mapping = False access_provider = simple simple_allow_groups = grp-rolle-LinuxAdmins, gpr-bere-LinuxPLUTO11
Konfiguration:
sudo nano /etc/sssd/sssd.conf
WICHTIG: For Nested group membership practice, only works with “Simple Access Provider”!
- use_fully_qualified_names auf False setzen
- ldap_id_mapping = True
- access_provider = simple
- simple_allow_groups = CORP-LinuxServerAdmins, ubuntu2004-im
also:
[sssd] domains = corp.itsroot.biz config_file_version = 2 services = nss, pam [domain/corp.itsroot.biz] default_shell = /bin/bash krb5_store_password_if_offline = True cache_credentials = True krb5_realm = CORP.ITSROOT.BIZ realmd_tags = manages-system joined-with-samba id_provider = ad fallback_homedir = /home/%u ad_domain = corp.itsroot.biz use_fully_qualified_names = False ldap_id_mapping = False access_provider = simple simple_allow_groups = CORP-LinuxServerAdmins, ubuntu2004-im
sudo systemctl restart sssd
Test für login:
sudo login ubuntu2004-im login: neku1opr Password:
(nun müsste das welcome Logo erscheinen und die Kommadozeile wechselt auf neku1opr@ubuntu2004-im:~$
Automatic home directory creation:
sudo pam-auth-update --enable mkhomedir
Kerberos Tickets:
sudo apt install krb5-user
Default Kerberos version5 realm:
CORP.ITSROOT.BIZ
Test einer smbclient verbindung mit AD User:
sudo login neku1opr@ubuntu2004-im:~$ smbclient -k -L ADServer01.corp.itsroot.biz Sharename Type Comment --------- ---- ------- ADMIN$ Disk Remote Admin C$ Disk Default share fsroot Disk Share for DFS Namespace fsroot IPC$ IPC Remote IPC NETLOGON Disk Logon server share software$ Disk Share for DFS Namespace software$ SYSVOL Disk Logon server share userdata Disk Share for DFS Namespace userdata SMB1 disabled -- no workgroup available neku1opr@ubuntu2004-im
Nun sollten wir ein Kerberos Ticket haben:
neku1opr@ubuntu2004-im:~$ klist Ticket cache: FILE:/tmp/krb5cc_720201236_Gniy71 Default principal: neku1opr@CORP.ITSROOT.BIZ Valid starting Expires Service principal 12.10.2020 10:19:01 12.10.2020 20:19:01 krbtgt/CORP.ITSROOT.BIZ@CORP.ITSROOT.BIZ renew until 13.10.2020 10:19:01 12.10.2020 10:19:12 12.10.2020 20:19:01 krbtgt/ITSROOT.BIZ@CORP.ITSROOT.BIZ 12.10.2020 10:19:12 12.10.2020 20:19:01 krbtgt/CORP.ITSROOT.BIZ@ITSROOT.BIZ 12.10.2020 10:19:44 12.10.2020 20:19:01 cifs/sonne11.corp.itsroot.biz@CORP.ITSROOT.BIZ neku1opr@ubuntu2004-im:~$
Usergruppen für sudo berechtigen:
sudo visudo
folgendes eintragen:
%CORP-LinuxServerAdmins ALL=(ALL) ALL %ubuntu2004-im ALL=(ALL) ALL
Domainusers as AdminIdentities
Bitte noch unix-group:CORP-LinuxServerAdmins; in folgendem Configfile hinzufügen.
sudo nano /etc/polkit-1/localauthority.conf.d/51-ubuntu-admin.conf
[Configuration] AdminIdentities=unix-group:sudo;unix-group:admin;unix-group:CORP-LinuxServerAdmins;
Update Upgrade 'n Stuff
Ubuntu 18.04 auf 20.04 schlägt fehl beim do-release-upgrade
deb http://ch.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
in /etc/apt/sources.list hinzufügen
Dies versuchen...wenns nicht klappt unten weiter machen:
sudo apt update && sudo apt install update-manager-core
dann den eintrag wieder entfernen
sudo apt update && sudo apt upgrade sudo apt install update-manager-core sudo apt --purge autoremove sudo do-release-upgrade
oder sudo do-release-upgrade -d
sudo reboot
sudo apt install clamav-daemon clamtk-gnome && sudo systemctl is-enabled clamav-daemon && sudo systemctl is-enabled clamav-freshclam
je nach dem noch externe ppas wieder aktivieren
check number of pending regular updates
RedHat
yum updateinfo list --quiet | wc -l
Nur Security Updates:
yum updateinfo list sec --quiet | wc -l
Ubuntu
/usr/lib/update-notifier/apt-check 2>&1 | cut -d ';' -f 1
Nur Security Updates:
/usr/lib/update-notifier/apt-check 2>&1 | cut -d ';' -f 2
last time since the system was updated
RedHat
rpm -qa --queryformat '%{installtime} (%{installtime:date}) %{name}\n' | sort -n | tail -n 1
Ubuntu
find /boot/ini* -printf '%Cs\n' | head -1
Zertifikate Certificates
PFX-Datei in PEM-Datei konvertieren Konvertierung in eine kombinierte PEM-Datei
Um eine PFX-Datei in eine PEM-Datei zu konvertieren, die sowohl das Zertifikat als auch den privaten Schlüssel enthält, muss der folgende Befehl verwendet werden:
openssl pkcs12 -in filename.pfx -out cert.pem -nodes
Konvertierung in separate PEM-Dateien
Mit folgenden Befehl können Sie den privaten Schlüssel aus einer PFX-Datei in eine PEM-Datei extrahieren:
openssl pkcs12 -in filename.pfx -nocerts -out key.pem
Nur das Zertifikat exportieren:
openssl pkcs12 -in filename.pfx -clcerts -nokeys -out cert.pem
Entfernen des Kennworts aus dem extrahierten privaten Schlüssel:
openssl rsa -in key.pem -out server.key
Automatisation
Ansible
docs.ansible.com
awx wäre ein zentraler manager für ansible
Playbook
Beispiel installiere Updates und reboote falls nötig
--- - hosts: all tasks: - name: updating the System yum: name: '*' state: latest - name: installing needreboot yum: name: yum-utils state: present - name: need-restart? command: needs-restarting -r failed_when: false register: reboot - name: reboot the system if required debug: msg: this would reboot now the System when: reboot.rc == 1
Beispiel User create und in sudoers wheel einpflegen
--- - hosts: all tasks: - name: create user user: tester password: "{ { 'testpw' | password_hash('sha512, 'testsalt') }}" # oder gleich den hash eingeben mit password: "hash" append: yes groups: wheel
Inventar
alsible-inventory --graph
--- ypsomed: vars: ansible_user: root
--- test: hosts: me: ansible_connection: local
Docker
Aufbau
Persistent Volumes einbinden
- Volume im Hostsystem erstellen oder einbinden
- SELinux berechtigen (siehe unten)
- docker run -tid -e MYSQL_ROOT_PASSWORT=testpw -v /DatenPresistentPfad:/liv/var/ --name mariadb mariadb:latest
SELinux Anpassungen für Doker zügs
Persistent Volumes ausserhalb Docker SELinux berechtigen
chcon -Rt svirt_sandbox_file_t /Dateipfad oder neu chcon -Rt container_file_t /Dateipfad
Starten eines Docker Containers
docker start -ti [ContainerName]
-ti um in den Container mit dem Terminal zu verbinden.
Port Weiterleitung
Port von extern nach inter mit den definierten Ports
-p 3306:3306 -p 80:80
siehst du denn mit docker ps
Docker Images
traefik iste ein toller reverseproxy
Netzwerk
Standard ist Bridge Network
=== Docker Image IP und Infos sehen
docker inspect e113fa732eca
Prozess Management
ps
für mein Login:
ps
alle Prozesse:
ps -ef
top
dystemd
Überblick der running Services
systemctl --state=running UNIT LOAD ACTIVE SUB DESCRIPTION session-843.scope loaded active running Session 843 of user neku1adm auditd.service loaded active running Security Auditing Service chronyd.service loaded active running NTP client/server
Target sind nun die alten Runlevels
Dependensylist eines Services:
[root@tiaki02 ~]# systemctl list-dependencies sshd sshd.service ● ├─sshd-keygen.service ● ├─system.slice
Definition anzeigen eines Services:
[root@tiaki02 ~]# systemctl cat sshd # /usr/lib/systemd/system/sshd.service [Unit] Description=OpenSSH server daemon Documentation=man:sshd(8) man:sshd_config(5) After=network.target sshd-keygen.service Wants=sshd-keygen.service [Service] Type=notify EnvironmentFile=/etc/sysconfig/sshd ExecStart=/usr/sbin/sshd -D $OPTIONS ExecReload=/bin/kill -HUP $MAINPID KillMode=process Restart=on-failure RestartSec=42s [Install] WantedBy=multi-user.target [root@tiaki02 ~]#
alle offenen files lsof
lsof | grep etc
oder
lsof /etc/ssh/
Loging
Logs allgemein
/var/log/
/var/log/audit
/var/Log/messages alles ausser die definierten logs
journalctl --since 9:05:00 --until 12:00:00 -p nur warnings -u sshd sehr Hilfreich -b bootlogs -b -1 bootlogs vorletster boot
Suche
less FILE und dann "/" für Suche Taste n für next Schift+G Ende vom Log
last
Loging History
last
Networking
ip addr ip l Physikalisch Links ip r route
/etc/sysconfig/network-scripts/ifcfg-ens192
nmcli con - Connections anzeigen, es können mehrere Connections pro IF angelegt werden nmcli d - Devices === Hostname === hostnamectl
set-hostnamectl tsetserver2
=== timedatectl === Zeitzonen einstellen
Tools
Telnet
telnet google.ch:80 GET /HTML1.1
telnet localhost:22
netcat
nc localhost 22
nc localhost 1-100
MiniChat =)
nc -l 4444 auf dem einen Host auf dem anderen Host nc IP Port nc 172.1.1.23 4444
nmap
nmap localhost -
ethtool
ethtool ens192
Proxy
Proxy System weit aktivieren
To set the proxy environment variables to apply to all the system users or persistent across all shells, you can append these lines to /etc/environment.
echo -e "http_proxy=http://192.168.43.100:3128/\nhttps_proxy=https://192.168.43.100:3128/" | sudo tee -a /etc/environment
http_proxy=http://192.168.43.100:3128/ https_proxy=https://192.168.43.100:3128/
Note that these settings will only take effect on login again since the /etc/environment is read on system login. However, you can still use netplan command to apply the settings.
sudo netplan apply
To test this out, try to download anything from the terminal or run the system update. You will see that the connections is happening through the proxy server.
wget google.com --2019-03-23 12:34:05-- http://google.com/ Connecting to 192.168.43.100:3128...
sudo apt update 0% [Connecting to 192.168.43.100 (192.168.43.100)] [Connecting to 192.168.43.100 (192.168.43.100)]...
Proxy nur für APT
To configure proxy settings for APT only, you can simply create proxy configuration file under /etc/apt/apt.conf.d/.
echo -e 'Acquire::http::Proxy "http://192.168.43.100:3128/";\nAcquire::https::Proxy "https://192.168.43.100:3128/";' | sudo tee /etc/apt/apt.conf.d/02proxy
Acquire::http::Proxy "http://192.168.43.100:3128/"; Acquire::https::Proxy "https://192.168.43.100:3128/";
If your proxy server requires username/password authentication, then the environment variables would set as below;
http_proxy=http://Username:Password@192.168.43.100:3128/ https_proxy=https://Username:Password@192.168.43.100:3128/
For APT;
Acquire::http::Proxy "http://Username:Password@192.168.43.100:3128/"; Acquire::https::Proxy "https://Username:Password@192.168.43.100:3128/";
If you are looking at running at command for just that moment via proxy, you may prefix apt command with proxy settings as shown below;
sudo 'http_proxy=http://192.168.43.100:3128' apt update
or
sudo 'http_proxy=http://Username:Password@192.168.43.100:3128' apt update
Firewall
Gufw Firewall on Ubuntu
To block IP ranges fillout like this:
172.16.98.0/24
Security
Security Check
für Ubuntu und Debian:
Checksecurity besteht aus einer Reihe von Plugins, die Sie jeweils in einer Konfigurationsdatei anpassen. Die entsprechenden Files liegen im Textformat vor, zum Einrichten des Diensts genügt daher ein einfacher Editor. Beim Aufruf von Checksecurity arbeitet das Programm die aktivierten Plugins nacheinander ab und gibt die Ergebnisse der Tests im Terminal aus.
- Checksecurity --> PM
SELinux / Apparmor
User die in SELinux eingebunden sind. semanage user -l
Wichtig sind
- fcontext
- boolean
Portconfigs
Show Portconfics
semanage port -l
z.B. semanage -l | grep http
ad a Port to http SELinux Roule (-a = add, -m = modifie) :
semanage port -a -t http_port_t -p tcp 9192
Filemanagement
fcontext
Zeigt SELinux Parts
[root@tiaki02 ~]# ls -lZ -rw-------. root root system_u:object_r:admin_home_t:s0 anaconda-ks.cfg -rw-r--r--. root root unconfined_u:object_r:admin_home_t:s0 qq [root@tiaki02 ~]#
User : object : Type : Sercurity Level system_u :object_r :admin_home_t:s0
Ändern fcontext to librarry:
semanage fcontext -a -t sshd_key_t /etc/ssh/sshd_conmfig
ändern mit chcon (nur temporär: change a Type
chcon -t ssh_key_t /etc/sshd/sshd_config
Reset der chcon
restorechcon -v /etc/sshd/ssd_config
semanage fcontext -a -t sshd_key_t /etc/ssh/sshd_conmfig
boolean
semanage boolean -l |grep httpd
logs
/var/log/audit/audit.log
Es kann auch ein einzelner Typ auf permissive gesetzt werden
semanage permissive -a ssh_t
und mit folgendem wird dies aufgelistet:
semanage permissive -l
netstat
Sehen an welchen Ports was hört:
netstat -tulpn
Z.B. sehen welche IPs im augenblick auf eine webseite connected sind:
netstat -tn | grep ESTA | grep ":80 "
oder als anfang für eine Statistik:
netstat -tnc | grep ESTA | grep ":80 ">>stats.txt
fail2ban
Dynamischer FW Blocker für Bruteforce Attacken.
Kurs
RedHat Software Collection RHSCL
Debug
zb:
journalctl -u crond -f
User
userdel [USERtoDELETE] useradd [NEWUSER] passwd [NEWUSER]
User abmelden CLI
who -u
that give you the PID
Then you can kill the user session.
kill "pid"
oder sudo pkill -9 -u username
SAN/FC/HBA/Disc
Display Physical Volume
pvdisplay
Display Logical Group
vgdisplay
Display Logical Volume
lvdisplay
SAN Karte identifizieren
[root@hszf04 scsi]# lspci -nn | grep "Fibre Channel" 24:00.0 Fibre Channel [0c04]: QLogic Corp. ISP2532-based 8Gb Fibre Channel to PCI Express HBA [1077:2532] (rev 02) 27:00.0 Fibre Channel [0c04]: QLogic Corp. ISP2532-based 8Gb Fibre Channel to PCI Express HBA [1077:2532] (rev 02) [root@hszf04 scsi]#
Check ob die HBA Treiber im Kernel geladen sind
[root@hszf04 scsi]# lsmod | grep qla2xxx qla2xxx 621980 0 scsi_transport_fc 64056 1 qla2xxx [root@hszf04 scsi]#
SAN Port Status
[root@hszf04 scsi]# cat /sys/class/fc_host/host*/port_state Online Online [root@hszf04 scsi]#
Passwörter
Reset root PW
getestet auf RedHat RHEL7
- Reboot the system .
- In the grub menu, press escape key to prevent the system from booting. Edit the grub menu by pressing “e” .
- Press the arrow keys to get the “linux16” line and press “end” key. This will take you to the end of the line.
- Here add ” rd.break console=tty1 ”
- Press control-x to boot the system.
- You will get the “switch-root” prompt like below.
- switch_root:/# mount -o remount,rw /sysroot
- switch_root:/# chroot /sysroot
- sh-4.2# passwd root
- By default, SE-Linux will be enabled on RHEL7 . So create a blank file in the name of “.autorelabel” under root. sh-4.2# touch /.autorelabel
- Exit from the chroot jail and exit from the initramfs.
- System will reboot and perform a full SELinux relabel , then reboot again.
- Once the system is rebooted, you will be able to login with new root password which you have set it
Bootstik
Windows Bootstik auf Linux erstellen
- Etcher https://etcher.io/
- Multiboot - Geil - aber ersteuä uf windoof https://pendrivelinux.com/yumi-multiboot-usb-creator/
SAMBA
Einzelne Hosts berechtigen ohne Useranmeldung
smb.conf
#smb.conf is the main Samba configuration file. You find a full commented #version at /usr/share/doc/packages/samba/examples/smb.conf.SUSE if the #samba-doc package is installed. # Date: 2013-12-13 [global] workgroup = WORKGROUP passdb backend = tdbsam printing = cups printcap name = cups printcap cache time = 750 cups options = raw map to guest = Bad User include = /etc/samba/dhcp.conf logon path = \\%L\profiles\.msprofile logon home = \\%L\%U\.9xprofile logon drive = P: usershare allow guests = Yes security = share ; unix extensions = no ### SQL Backup Shares - Tests ### include = /etc/samba/shares/shares.conf
In der includeten shares.conf können pro Share verschiedene Einstellungen gemacht werden.
Bei wenigen Shares können die Shareangaben auch gleich direkt in der smb.conf gepflegt werden
/etc/samba/shares/shares.conf
[test] comment = Temporary file space path = /tmp/test read only = no browseable = yes writeable = yes public = yes [v05zck] comment = Test Share zum Einrichttest path = /mnt/nfs_cifs_sql/v05zck browseable = yes read only = no create mode = 0777 public = yes hosts deny = ALL hosts allow = 172.27.41.195 [v06tst] comment = for SLQ Server v06tst path = /mnt/nfs_cifs_sql/hhh browseable = yes read only = no create mode = 0777 public = yes hosts deny = ALL hosts allow = 172.27.41.94 172.27.41.201 172.27.41.195
VLAN hinzufügen
suse:
- gehe als root ins Verzeichnis */etc/sysconfig/network*
- kopiere am einfachsten eine bestehene vlan Config cp -p ifcfg-vlan1292 ifcfg-vlan***
- bearbeite sie mit vi ifcfg-vlan***
- lese die Configs neu ein: rcnetwork restart
- kontrolliere mit ifconfig das IF....voila
Startablauf
/etc/init.d
- Startscript in /etc/init.d/ erstellen
- Aktivieren mit chkconfig
hbli01:/etc/init.d # chkconfig gst --list gst 0:off 1:off 2:off 3:off 4:off 5:on 6:off hbli01:/etc/init.d # chkconfig gst off insserv: script nsrps is broken: incomplete LSB comment. insserv: missing `Provides:' entry: please add. hbli01:/etc/init.d # chkconfig gst on insserv: script nsrps is broken: incomplete LSB comment. insserv: missing `Provides:' entry: please add. insserv: Service network is missed in the runlevels 4 to use service agentsvc insserv: Service syslog is missed in the runlevels 4 to use service agentsvc insserv: Service ipmidrv is missed in the runlevels 4 to use service hp-health insserv: Service networker is missed in the runlevels 3 to use service gst hbli01:/etc/init.d # chkconfig gst --list gst 0:off 1:off 2:off 3:on 4:off 5:on 6:off hbli01:/etc/init.d #
Ubuntu 18.04/Autostart
für Dektop Programme
Für alle Benutzer
Eine Sitzung gilt natürlich immer nur für den Benutzer, der gerade angemeldet ist. Soll ein Programm immer gestartet werden, egal welcher Benutzer sich gerade anmeldet, so ist dies auch möglich. Dazu muss man im Verzeichnis /etc/xdg/autostart/ mit Root-Rechten eine .desktop-Datei für das zu startende Programm mit einem Texteditor [1][2] anlegen. Die Datei darf einen beliebigen Namen besitzen, muss aber die Endung .desktop haben, z.B. MeinStartProgramm.desktop. Eine minimale .desktop-Datei hat folgendes Format:
[Desktop Entry] Type=Application Name=Musterprogramm Exec=Auszuführendes Kommando
Will man zusätzlich steuern, in welchen Desktop-Umgebungen der Autostart ausgeführt wird, benötigt man eine weitere Zeile wie:
OnlyShowIn=GNOME;Unity; # diese Datei wird nur in GNOME und Unity gestartet # oder alternativ NotShowIn=
Autostart einrichten
Annahme in dieser Anleitung: Der eingeschränkte Benutzer für OpenSim heißt "maria".
Wir kopieren das folgende Skript mit beispielsweise dem Dateinamen "maria-autostart.sh" als user root nach /etc/systemd/system . (Es kann ein beliebiges Verzeichnis gewählt werden, wir wählen hier der Übersichtlichkeit halber das Verzeichnis mit der Konfigurationsdatei.) Mit diesem Script wird beim Rechnerstart das selbstgemachte Firewall-Script aufgerufen. Schließlich wird der Benutzer auf den eingeschränkten OpenSim-Account gesetzt (hier maria), und in dessen Home-Verzeichnis eine Datei "autostart.sh" aufgerufen. Über die autostart.sh kann später der eingeschränkte Benutzer beim Hochlauf selber Programme starten.
vi /etc/systemd/system/maria-autostart.sh
#!/bin/sh # # /etc/systemd/system/maria-autostart.sh case $1 in start) bash /root/firewall.sh su maria -l -c 'bash autostart.sh' & ;; stop) ;; *) echo "Usage: $0 {start|stop}" exit 1 ;; esac
Danach setzen wir die Ausführungsrechte:
chmod u+x /etc/systemd/system/maria-autostart.sh
Damit unser Script als Service gestartet werden kann, benötigt es noch eine Konfigurationsdatei. Hier ist das Verzeichnis /etc/systemd/system zwingend, die Dateiendung .service ebenso. Also nennen wir die Konfigurationsdatei sinnvoll "maria-autostart.service":
vi /etc/systemd/system/maria-autostart.service
[Unit] Description=At system boot start firewall and call autostart.sh of user. [Service] Type=oneshot ExecStart=/etc/systemd/system/maria-autostart.sh start ExecStop=/etc/systemd/system/maria-autostart.sh stop RemainAfterExit=yes [Install] WantedBy=multi-user.target
Wenn beide Dateien erstellt sind, muss der neue Service noch aktiviert werden:
systemctl enable maria-autostart.service
Nun logge mit dem eingeschränkten OpenSim-Account ein und erstelle in dessen Home-Verzeichnis (hier maria) eine vorerst leere Textdatei mit dem Namen "autostart.sh". Diese Datei wird später mit den Startbefehlen für OpenSim gefüllt. Mache dies nicht als User root, weil sonst später der eingeschränkte User die Datei nicht ändern kann! Setze Ausführungsrechte: "chmod u+x autostart.sh"
Rechner einmal täglich booten
(Zur Vertiefung siehe auch: https://wiki.ubuntuusers.de/Cron/)
OpenSim ist ja noch im Beta-Stadium, und läuft manchmal nicht ganz stabil. Deshalb soll der Rechner jeden Tag einmal neu starten. Füge dafür in der Datei /etc/crontab folgende Zeile ein:
0 6 * * * root shutdown -r now
Die Zahlen geben die Uhrzeit an, hier 6:00 Uhr.
IPMI
ipmitool installieren
auf ipmi adresse verbinden
ipmitool -I lanplus -H xxx.xxx.xxx.xxx -U admin shell
Zovi - Test ob login ohne PW möglich (cipher-suite-0 attack) =)
ipmitool -I lanplus -H xxx.xxx.xxx.xxx -P bad_passwd -C0 user list oder ipmitool -I lanplus -H xxx.xxx.xxx.xxx -U admin -P bad_passwd -C0 user list oder ipmitool -I lanplus -H xxx.xxx.xxx.xxx -U root -P bad_passwd -C0 user list
Allgemein
Message Banner Login Text
Banner für User
Für einen speziellen User ein Login Banner machen
vi ~/.bashrc --- echo "################################################################################################################################" echo "-------------------- Maybe Networker Servers are in \"Failover mode\", be careful, you're logged in on hbeh05 --------------------" echo "################################################################################################################################"
Login Banner
Welcome Banner für alle
vi /etc/motd
############################### # # # Welcome on Machine1 # # # ###############################
um die Farben zu wechseln mus folgendes gemacht werden:
[user@box]$ echo -en "\033[1;34m" >> /etc/motd [user@box]$ echo "Colored text of your motd file....." >> /etc/motd [user@box]$ echo -en "\033[0m" >> /etc/motd
Code Color ----------------------------- [0;30m | black text [0;31m | red [0;32m | green [0;33m | blue [0;34m | purple [0;35m | cyan [0;36m | silver [0;40m | red back. [0;41m | green back. [0;42m | brown back. [0;43m | blue back. [0;44m | purple back. [0;45m | cyan back. [0;46m | silver back. background +---------------------------------------+ |Dark Gray 1;30 | |Light Blue 1;34 | |Light Green 1;32 | |Light Cyan 1;36 | |Light Red 1;31 | |Light Purple 1;35 | |Yellow 1;33 | |White 1;37 | +---------------------------------------+ Beispiel: rm /etc/motd && echo "_/ _/ _/ _/ _/ _/_/_/ _/_/_/ _/_/ _/_/_/ _/_/ _/_/ _/_/_/ _/ _/ _/ _/_/ _/ _/ _/ _/ _/ _/_/_/_/ _/ _/ _/ _/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/_/ _/_/_/ _/_/ _/ _/ _/ _/_/_/ _/_/_/ _/ _/" >> /etc/motd && echo -en "\033[1;31m" >> /etc/motd && echo " _ _ | | |_ ._ _|_ ) |_|_ / \ |_|_ | _|_ _ |_| |_) |_| | | |_ |_| /_ | o \_/ | |_ |_ _>" >> /etc/motd && echo -en "\033[0m" >> /etc/motd && echo " Managed by Network Team " >> /etc/motd && cat /etc/motd
Auslesen CPU
Usage nach Prozess:
top
Ussage pro CPU:
mpstat -P ALL 2
Auslesen Memory used
vmstst 3
Grösse auslesen von Ordner
du -hs /<pfad>/*
Zeigt nur diesen Ordner an:
du -hs /<pfad>/
"-d 0" zeigt nur ein Level von Ordnern an und rechnet sie zusammen
du -h -d 0 /mnt/nfs_cifs_sql/
BM zeigt Resultat in MB an
du -hBM -d 0 /mnt/nfs_cifs_sql/*
Sortieren nach grösse
du -hs /var/* | sort -h
Netzwerk zügs
WIFI
Echtzeit Signalstärke sehen
watch -n1 iwconfig
Bonding
Bonding Modes
Descriptions of bonding modes
Mode 0
balance-rr
Round-robin policy: Transmit packets in sequential order from the first available slave through the last. This mode provides load balancing and fault tolerance.
Mode 1
active-backup
Active-backup policy: Only one slave in the bond is active. A different slave becomes active if, and only if, the active slave fails. The bond's MAC address is externally visible on only one port (network adapter) to avoid confusing the switch. This mode provides fault tolerance. The primary option affects the behavior of this mode.
Mode 2
balance-xor
XOR policy: Transmit based on selectable hashing algorithm. The default policy is a simple source+destination MAC address algorithm. Alternate transmit policies may be selected via the xmit_hash_policy option, described below. This mode provides load balancing and fault tolerance.
Mode 3
broadcast
Broadcast policy: transmits everything on all slave interfaces. This mode provides fault tolerance.
Mode 4
802.3ad
IEEE 802.3ad Dynamic link aggregation. Creates aggregation groups that share the same speed and duplex settings. Utilizes all slaves in the active aggregator according to the 802.3ad specification.
Prerequisites: 1.Ethtool support in the base drivers for retrieving the speed and duplex of each slave. 2.A switch that supports IEEE 802.3ad Dynamic link aggregation. Most switches will require some type of configuration to enable 802.3ad mode.
Mode 5
balance-tlb
Adaptive transmit load balancing: channel bonding that does not require any special switch support. The outgoing traffic is distributed according to the current load (computed relative to the speed) on each slave. Incoming traffic is received by the current slave. If the receiving slave fails, another slave takes over the MAC address of the failed receiving slave.
Prerequisites:
1.Ethtool support in the base drivers for retrieving the speed of each slave.
Mode 6
balance-alb
Adaptive load balancing: includes balance-tlb plus receive load balancing (rlb) for IPV4 traffic, and does not require any special switch support. The receive load balancing is achieved by ARP negotiation. The bonding driver intercepts the ARP Replies sent by the local system on their way out and overwrites the source hardware address with the unique hardware address of one of the slaves in the bond such that different peers use different hardware addresses for the server.
Teaming LACP einrichten
SusE
hbzf01:~ # cat /etc/sysconfig/network/ifcfg-bond0 DEVICE='bond0' BOOTPROTO='static' IPADDR='172.27.34.15/24' BROADCAST='172.27.34.255' STARTMODE='auto' PREFIXLEN='24' STARTMODE='auto' USERCONTROL='no' BONDING_MODULE_OPTS='mode=4 lacp_rate=1 miimon=100' BONDING_MASTER='yes' BONDING_SLAVE0='eth0' BONDING_SLAVE1='eth1' BONDING_SLAVE2='eth2' BONDING_SLAVE3='eth3' BONDING_SLAVE4='eth4' BONDING_SLAVE5='eth5' BONDING_SLAVE6='eth6' BONDING_SLAVE7='eth7' hbzf01:~ # hbzf01:~ # cat /etc/sysconfig/network/ifcfg-eth0 DEVICE='eth0' BOOTPROTO=none ETHTOOL_OPTIONS='autoneg on' STARTMODE='off' USERCONTROL='no' MASTER=bond0 SLAVE=yes hbzf01:~ #
RedHat
First, create a new file in the /etc/sysconfig/network-scripts directory called ifcfg-team0 that looks like this:
DEVICE=team0 DEVICETYPE=Team ONBOOT=yes BOOTPROTO=none IPADDR=1.2.3.4 NETMASK=255.255.255.0 TEAM_CONFIG='{"runner": {"name": "lacp"}, "link_watch": {"name": "ethtool"}}'
Obviously you need to change the IP address and netmask appropriately.
Then in the same directory, change all of the ifcfg-eno[1-4] files to look like this:
DEVICE=eno1 HWADDR=00:11:22:33:44:55 DEVICETYPE=TeamPort ONBOOT=yes TEAM_MASTER=team0 TEAM_PORT_CONFIG='{"prio": 100}'
As above, your local files will differ a bit, because you will need to preserve the existing HWADDR setting.
This is straight out of the manual.
The ifcfg-team0 file refers to the lacp.conf file you have already created. I do not see in the manual how it finds that file, however. Perhaps teamd remembers it from your earlier manual configuration, or perhaps you have to put it in a common directory.
Anyway, once this is configured, you say ifup team0, and the teamed NIC group will all come up together. The individual interfaces need to be down at the start, but you won't need to do anything special to ensure that on boot, since they're now marked as part of a NIC team. The OS's boot configuration will realize that it shouldn't bring those four interfaces up individually, but only as part of the NIC team.
All of the above assumes you have disabled NetworkManager and gone back to the good old way of configuring networking on Red Hat type Linuxes:
$ sudo systemctl stop NetworkManager.service $ sudo systemctl disable NetworkManager.service $ sudo systemctl start network.service $ sudo systemctl enable network.service
This is often a good idea on servers, particularly when their network configuration starts getting tricky, as with LACP. NetworkManager solves a lot of problems, but it often does so with a desktop-focused slant that is inappropriate for servers. For instance, it solves the automatic WiFi to Ethernet transitions common with laptops. Servers typically have static network configurations, so NetworkManager can end up just getting in the way.
Still, if you find yourself wanting to stick with Red Hat's defaults, they do cover that alternative a few sections earlier in the manual.
Bondingstatus der einzelnen IFs sehen
go to:
hszf04:/ # cd /proc/net/bonding hszf04:/proc/net/bonding # hszf04:/proc/net/bonding # hszf04:/proc/net/bonding # l total 0 -r--r--r-- 1 root root 0 Jun 3 11:11 bond0 -r--r--r-- 1 root root 0 Jun 3 11:11 bond1 hszf04:/proc/net/bonding # cat bond1
IP Interfaces live Monitoring
SAR
sar -n DEV 1 10
zeigt alle Netzwerkinterfaces im Sekundentakt mit diversen Übertragungsraten an. Die letzte Zahl ist der Counter um die Anzeige soviel mal zu aktualisieren (hier 10 mal).
BMON
Kommandozeilen Tool mit Ansicht pro Interface und Historyfunktion
sudo apt-get install bmon
Status der einzelnen IFs sehen
eth
ethtool eth4
Bonding
bei Suse:
less /proc/net/bonding/bond1
Verbundene tcp - udp Sessions auf IPs ikl. Ports anzeigen
netstat -an | grep 192
Hier im Beispiel alle 192.*** er Adressen
ARP, Neighbor, Scan und co.
kleiner witziger Sniffer
sudo ngrep -d eth0 -i "irgendöppis(suechwort)"
oder
netcat -z -v [Hostname] [Portrange] zB: netcat -z -v sonne33.pipapo.ch 1-1230 netcat -z sonne33.pipapo.ch 1-1230
fing
You can also install the tool fing and do a network discovery using this tool. It available as a RPM/DEB, that you can just install standalone. The makers of this tool also make FingBox, which is a mobile application for doing the same thing.
$ sudo fing 20:59:54 > Discovery profile: Default discovery profile 20:59:54 > Discovery class: data-link (data-link layer) 20:59:54 > Discovery on: 192.168.1.0/24 20:59:55 > Discovery round starting. 20:59:55 > Host is up: 192.168.1.20 HW Address: 00:26:C7:85:A7:20 (Intel) Hostname: greeneggs.bubba.net ... ... ------------------------------------------------------------------------------- | State | Host | MAC Address | Last change | |-----------------------------------------------------------------------------| | UP | 192.168.1.1 | 00:18:51:4X:XX:XX | | | UP | 192.168.1.2 | 00:25:22:1X:XX:XX | | | UP | 192.168.1.3 | 00:19:D1:EX:XX:XX | | | UP | 192.168.1.4 | 00:A0:CC:3X:XX:XX | | ...
Don't let this tools simplicity fool you though. You can output the contents into csv files as well as html files:
$ sudo fing -n 192.168.1.0/24 -o table,html,blah.html
Then view it:
$ elinks blah.html
To write out the results in CSV format:
$ sudo fing -o log,text log,csv,my-network-log.csv
To discover a specific block of IPs you can explicityly tell fing what IP block to scan:
$ sudo fing -n 192.168.1.0/24
Sonstiges
Version der Distri und Kernelversion anzeigen
hostnamectl
Patchscript anstossen
/usr/local/scripts/do_youpatch.sh reboot oder wenn im gleichen Ordner ./do_youpatch.sh reboot
du
Diskusage
Grössenangabe von Ordner
Zeigt alle Unterordner an
du -hs /<pfad>/*
Beispiel: hszf01:/ # du -hs /mnt/nfs_cifs_sql/* 420G /mnt/nfs_cifs_sql/c05awg 61G /mnt/nfs_cifs_sql/c05awh 227G /mnt/nfs_cifs_sql/c05awv 173G /mnt/nfs_cifs_sql/c05aww 30G /mnt/nfs_cifs_sql/c05fgk 62G /mnt/nfs_cifs_sql/c05gxl 512 /mnt/nfs_cifs_sql/c05gxm 170G /mnt/nfs_cifs_sql/v062qd 325M /mnt/nfs_cifs_sql/v064ae 512 /mnt/nfs_cifs_sql/v067is 3.2G /mnt/nfs_cifs_sql/v069fo hszf01:/ #
Zeigt nur diesen Ordner an
du -hs /<pfad>/
Beispiel: hszf01:/ # du -hs /mnt/nfs_cifs_sql/ 7.0T /mnt/nfs_cifs_sql/ hszf01:/ #
Zeige die grösten Files an
du -h | sort -rh | head -20
df
df -h
zeigt alle Partitionen und Mounts an
ps
ps -ef
zB zeigt alle offenen Telnet sessions:
ps -ef|grep telnet
kill
kill [PID]
zb:
kill 42338
chkconfig
chkconfig -A
RPM to DEB - alien
um ein rpm Installationspaket in eine deb (Debian) version zu konvertieren bitte folgendes beachten. Anleitung
Remainder:
sudo alien -k name-of-rpm-file.rpm
Root rechte
Verknüpfung zu Programm mit "root" starten
- Starter (Verknüpfung) erstellen oder praktischer den Original Starter kopieren
- in den Eigenschaften des Starters zum Feld "Befehl" navigieren
- vor dem Original Startbefehl gksu einfügen.
Also:
gksu <programm>
z.B.: Nautilus
*gksu* nautilus --no-desktop computer:
oder
- Installiere das Paket Menu: *sudo apt-get install menu*
- Starter (Verknüpfung) erstellen oder praktischer den Original Starter kopieren
- in den Eigenschaften des Starters zum Feld "Befehl" navigieren
- vor dem Original Startbefehl *su-to-root -X -c* einfügen.
Also:
su-to-root -X -c <programm>
z.B.: Nautilus
su-to-root -X -c nautilus --no-desktop computer:
Script in Ubuntu mit root Rechten laufen lassen
>>>Dies ist aus
>>>Sicherheitsgründen so, da es relativ einfach ist über ein setuid-root
>>>shellscript zu einer root shell zu kommen.
>>
>>Das macht Sinn.
>>
>>
>>>Ich verstehe nicht, wieso du dein script nicht mit sudo startest (z.B.
>>>sudo /root/script). So kannst du das gut testen bis Du das in der
>>>crontab eingetragen hast.
>>
>>Das kann ich, dann muss ich aber auch alle Befehle innerhalb des Scripts
>>mit sudo versehen, sonst gibt es das genannte Problem.
>
>
> Dann machst du definitiv noch etwas falsch. Ich vermute mal, dass das
> nichts mit den Rechten zu tun hat, sondern einfach an deinem Skript
> liegt. Wenn du das Skript mit sudo startest, dann läuft es mit UID 0
> (root) und das gilt auch für alle Prozesse, die das Skript startet.
>
>
>>Mir ist noch nicht ganz klar, warum die crontab dann später ohne sudo
>>auskommt, aber ich brav sudo eintippen muss. Bisher bin ich immer davon
>>ausgegangen "was root gehört, darf alles" und der Inhalt von /bin z.B.
>>gehört ja root.
>
> Zuerst zu cron: Cron läuft ja bereits als root. Es kann also weitere
> Prozesse (z.B. die Cronjobs) als root starten. Also hier ist kein
> Problem.
> Ich glaube dir ist noch nicht ganz klar, wie das sudo/root Konzept von
> Ubuntu aussieht. Der root Account auf einem Ubuntu System existiert
> genauso wie auf jedem anderen System auch. Er hat einfach ein
> deaktiviertes Passwort. Das hindert aber Daemons (wie cron) nicht daran
> als root zu laufen und sie benötigen dazu auch nicht sudo. Sudo brauchst
> du nur, wenn du als Benutzer etwas als mit root-Rechten laufen lassen
> willst. Der einzige Unterschied zwischen Ubuntu und einem "normalen"
> Linux Installation ist, dass du nicht also root einloggen kannst und
> dass du den Befehl su nicht benutzen kannst. Beides kannst du aber auch
> unter Ubuntu einfach ermöglichen, in dem du "sudo passwd" ausführst und
> dem root Account ein Passwort gibst.
> Das root Konzept von OS X ist im übrigen genau gleich wie jenes von
> Ubuntu.
>
> Nun noch zum "was root gehört, darf alles": Hier vermischt du die
> Dateisystemrechte einer ausführbaren Datei mit den Rechten eines
> laufenden Prozesses. Beides hat (abgesehen von setuid) eigentlich nichts
> miteinander zu tun. Egal wem eine ausführbare Datei gehört, erbt der
> Prozess, welcher entsteht wenn du sie ausführst immer die Rechte des
> Prozesses aus welchem er gestartet wurde. Also zum Beispiel die Rechte
> der Shell, wenn du einen Befehl auf der Shell eintippst. Das gesetzte
> setuid Bit ändert dieses verhalten. Dann bekommt der neue Prozess die
> Rechte des Owners der Binärdatei im Dateisystem. Z.B. sudo hat das
> setuid Bit gesetzt, da es als root laufen muss, um seine Funktion zu
> erfüllen.
>
>
>>Liegt des Rätsels Lösung also darin, dass der cronjob mit dem passenden
>>setuid-but ausgeführt wird und somit dessen Rechte automatisch auch für
>>das aktivierte Script gelten, während das Script alleine diese Rechte
>>offenbar gar nicht haben kann?
>
>
> Nein ein cron job mit setuid bit ist praktisch in jedem fall eine
> fehlkonfiguration. Der job erbt die Rechte vom cron daemon, welcher ihn
> startet und kann damit also root laufen. Bei Jobs in crontabs von
> Benutzern gibt cron seine root Rechte "freiwillig" auf und setzt die
> Rechte des Jobs auf die Rechte des Benutzers zu dem der Job gehört. Das
> kann cron, weil es als root läuft.
>
> So das wurde ja nun ein richtiger Crashkurs in Unix Prozessrechten.
Posted by Gaudenz
THX
Mount / Disk / Partitionen
SMART Checks
Tools zum überwachen von SMART fähigen HDDs und SSDs
Guter Beschrieb: https://www.howtoforge.com/tutorial/monitor-harddisk-with-smartmon-on-ubuntu/
CLI:
sudo apt-get install smartmontools
GUI:
sudo apt-get install gsmartcontrol
fstab
# NFS 10.1.1.222:/volume1/Moviez /media/Moviez nfs rw 0 0 10.1.1.222:/volume1/Serien /media/Serien nfs rw 0 0 10.1.1.222:/volume1/Dokus /media/Dokus nfs rw 0 0 10.1.1.222:/volume1/Music /media/Music nfs rw 0 0 10.1.1.222:/volume1/MusicVideos /media/MusicVideos nfs rw 0 0 10.1.1.222:/volume1/Hörbücher /media/Hörbücher nfs rw 0 0 10.1.1.222:/volume1/emby-backup /media/emby-backup nfs rw 0 0 # CIFS //10.1.1.221/share/Music/ /media/popcorn-music cifs credentials=/root/.smbcredentials-popcorn,iocharset=utf8,nounix,file_mode=0777,vers=2.1,dir_mode=0777 0 0 #//10.1.1.220/share/Video/ /media/popcorn-videos cifs credentials=/root/.smbcredentials-popcorn,iocharset=utf8,nounix,file_mode=0777,vers=2.1,dir_mode=0777 0 0 #//10.1.1.205/backup_maxtor/ /media/Maxtor-MusicBackup cifs credentials=/root/.smbcredentials-driver,iocharset=utf8,nounix,file_mode=0777,vers=2.1,dir_mode=0777 0 0 //10.1.1.225/Serien-Dokus/ /media/serien cifs credentials=/root/.smbcredentials-driver,iocharset=utf8,nounix,file_mode=0777,dir_mode=0777,vers=1.0 0 0 #//10.1.1.200/moviez/Moviez /media/Moviez-D-Z cifs credentials=/root/.smbcredentials-driver,iocharset=utf8,nounix,file_mode=0777,dir_mode=0777,vers=1.0 0 0 #//10.1.1.200/usbshare1/backup /media/Backup cifs credentials=/root/.smbcredentials-driver,iocharset=utf8,nounix,file_mode=0777,dir_mode=0777,vers=1.0 0 0 //10.1.1.225/Serien-Dokus/Music /media/popcorn-music cifs credentials=/root/.smbcredentials-driver,iocharset=utf8,nounix,file_mode=0777,dir_mode=0777,vers=1.0 0 0 //10.1.1.226/Moviez /media/Moviez cifs credentials=/root/.smbcredentials-driver,iocharset=utf8,nounix,file_mode=0777,dir_mode=0777,vers=1.0 0 0
- Disk
UUID=2fa34ca4-1e6c-4829-acc9-6f556f49628a /data1 ext4 acl,user_xattr 1 0
Disk
Eine zusätzliche Disk (für Programmdaten) unter /data1 (/data2, /data3,... falls mehrere gebraucht werden) einbinden. Nicht mehr mit LVM in der Root-Partition erweitert.
Dies hat viele Vorteile...
- Wenn das Programm inkl. seine Daten auf der Disk sind, kann das OS in wenigen Schritten neu aufgesetzt werden und das Programm wieder eingebunden werden (Linux is a File =) ).
- Wenn das Programm plötzlich die Disk vollschreibt (Logs oder so), bleibt das OS online und es kann damit getroubelshootet werden (bei einer vollen OS Disk läuft das Linux meisst nicht mehr richtig und ein Reboot wäre nicht mehr möglich.)
- Disk vergrössern ist viel einfacher (falls vmdk Disk) und in wenigen Schritten gemacht.
Um eine Disk z.B. vmdk ins System ein zu binden verwenden wir im fstab die UUID Methode. Mit der Pfad- Methode "/dev/sdb1" können nach grösseren Updates Verwechslungen in der Namensgebung der sd* Namen zu Fehlern beim Booten führen. Anleitung zusätzliche vmdk Disk einbinden:
Voraussetzung: VMDK Disk muss im vSphere erstellt und in der VM eingebunden sein.
- Ordner /data1 erstellen und mit "chmod 777 /data1" auf volle Berechtigungen für alle setzen.
- Mit "fdisk -l" die neue Disk scannen und den Pfad auslesen.
Z.B.
[root@elastica99 ~]# fdisk -l Disk /dev/sdb: 107.4 GB, 107374182400 bytes, 209715200 sectors Units = Sektoren of 1 * 512 = 512 bytes
→ falls nicht gefunden am besten ein Reboot machen und nochmals scannen.
- Partition erstellen:
mit "fdisk /dev/sdb"
n für new
p für Primary
1 für erste Partition
dann bei "First cylinder..." 2x Enter
t um die Partition zu selektieren
8e für definition als Linux LVM
w für write.
fdisk -l zum sehen ob die Partition im /dev/sdb1 erstellt wurde
- Mit mkfs.ext4 /dev/sdb1 Partition formatieren
→ kann je nach Grösse ein Weilchen dauern...wird aber angezeigt wenn fertig.
- Mit blkid UUID der Disk ermitteln:
[root@elastica99 ~]# blkid /dev/mapper/rhel-var: UUID="fd03042e-2cea-4ece-aef0-863f43d58101" TYPE="xfs" /dev/sda2: UUID="dXjhsD-Odzq-PpZe-tSvL-LTzJ-TRtc-POBEKD" TYPE="LVM2_member" /dev/sda1: UUID="3814658e-5e33-4860-bd93-f8847574396f" TYPE="xfs" /dev/sdb1: UUID="2fa34ca4-1e6c-4829-acc9-6f556f49628a" TYPE="ext4" /dev/mapper/rhel-root: UUID="f0f456e2-7af1-464b-9915-2e6014a8260b" TYPE="xfs" /dev/mapper/rhel-swap: UUID="efc441c0-b687-4816-a97e-3a03f461d8db" TYPE="swap" /dev/mapper/rhel-home: UUID="5dd48587-7c84-400b-b628-ac088af65a34" TYPE="xfs"
- Nun im fstab folgenden Eintrag machen (UUID natürlich noch anpassen):
UUID=2fa34ca4-1e6c-4829-acc9-6f556f49628a /data1 ext4 acl,user_xattr 1 0
- Mit mount -a die Disk einhängen und mit df -h kontrollieren
[root@elastica99 ~]# df -h Dateisystem Größe Benutzt Verf. Verw% Eingehängt auf /dev/mapper/rhel-root 8.0G 1.3G 6.8G 16% / devtmpfs 7.8G 0 7.8G 0% /dev tmpfs 7.8G 0 7.8G 0% /dev/shm tmpfs 7.8G 8.9M 7.8G 1% /run tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup /dev/sdb1 99G 61M 94G 1% /data1 /dev/mapper/rhel-var 7.0G 522M 6.5G 8% /var /dev/mapper/rhel-home 6.5G 33M 6.5G 1% /home /dev/sda1 497M 210M 288M 43% /boot tmpfs 1.6G 0 1.6G 0% /run/user/1004 [root@elastica99 ~]#
- RW- Test:
mkdir /data1/test
ll /data1
rm -R /data1/test
ll /data1
VM Disk / Volume vergrössern erweitern
Ubuntu
Ausser die Root ( / ) Partition können die gemounteten ohne Reboot vergrössert werden.
VM Disk vergrössern im vSphere
sudo su - echo 1 > /sys/block/sdb/device/rescan
natürlich noch die richtige Disk wählen (sda, sdb, sdc,...)
oder
sudo apt-get install scsitools -y sudo rescan-scsi-bus --forcerescan
gpart öffnen und folgendes machen:
- die zu vergrössernde Disk auswählen
- partition anwählen
- Button "Rezise/Move" cklicken
- Schieber aufs maximum vergrössern
- Resize Button cklicken
- Button "Apply all Operations" klicken
eh voila
Kontrolle z.B. mit df -h
LVM Disk / Volume vergrössern
- Füge eine neue VM Disk dem System zu (in vSphere)
- mit fdisk -l checken ob die Disk erkannt wurde
- müsste ca so aussehen:
[root@wega99 ~]# fdisk -l Disk /dev/sdb: 107.4 GB, 107374182400 bytes, 209715200 sectors Units = Sektoren of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk /dev/sda: 25.8 GB, 25769803776 bytes, 50331648 sectors Units = Sektoren of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes ...
- Erstelle Physical Volumes auf den neuen Disks
- pvcreate /dev/sdb
[root@wega99 ~]# pvcreate /dev/sdb Physical volume "/dev/sdb" successfully created. [root@wega99 ~]#
- lvmdiskscan -l um die erstellung zu überprüfen
[root@wega99 ~]# lvmdiskscan -l WARNING: only considering LVM devices /dev/sda2 [ 23.51 GiB] LVM physical volume /dev/sdb [ 100.00 GiB] LVM physical volume 1 LVM physical volume whole disk 1 LVM physical volume [root@wega99 ~]#
- Vergrößern des LV
- ... auf die maximale Größe
Um den sämtlichen nicht zugeordneten Speicherplatz für das logical Volume zu verwenden, ist folgendes Kommando erforderlich:
lvextend -l 100%FREE /dev/mapper/rhel-var
- ... auf **GB
lvextend -L 10G /dev/mapper/rhel-var
- Um den zusätzlichen Speicherplatz auch nutzen zu können, muss abschließend noch das Dateisystem vergrößert werden
Dies geschieht mit:
lvextend --resizefs -l +100%FREE /dev/mapper/rhel-var
[root@wega99 ~]# df -h Dateisystem Größe Benutzt Verf. Verw% Eingehängt auf /dev/mapper/rhel-root 8.0G 1.2G 6.9G 15% / devtmpfs 3.9G 0 3.9G 0% /dev tmpfs 3.9G 0 3.9G 0% /dev/shm tmpfs 3.9G 8.9M 3.9G 1% /run tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup /dev/sda1 497M 207M 290M 42% /boot /dev/mapper/rhel-var 7.0G 471M 6.6G 7% /var /dev/mapper/rhel-home 6.5G 33M 6.5G 1% /home tmpfs 783M 0 783M 0% /run/user/1003 [root@wega99 ~]# [root@wega99 ~]# [root@wega99 ~]# lvextend --resizefs -l +100%FREE /dev/mapper/rhel-var Size of logical volume rhel/var changed from 100.00 GiB (25601 extents) to 107.00 G Logical volume rhel/var successfully resized. meta-data=/dev/mapper/rhel-var isize=256 agcount=4, agsize=458752 blks = sectsz=512 attr=2, projid32bit=1 = crc=0 finobt=0 spinodes=0 data = bsize=4096 blocks=1835008, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0 ftype=0 log =Intern bsize=4096 blocks=2560, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =keine extsz=4096 blocks=0, rtextents=0 Datenblöcke von 1835008 auf 28050432 geändert. [root@wega99 ~]# [root@wega99 ~]# [root@wega99 ~]# df -h Dateisystem Größe Benutzt Verf. Verw% Eingehängt auf /dev/mapper/rhel-root 8.0G 1.2G 6.9G 15% / devtmpfs 3.9G 0 3.9G 0% /dev tmpfs 3.9G 0 3.9G 0% /dev/shm tmpfs 3.9G 8.9M 3.9G 1% /run tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup /dev/sda1 497M 207M 290M 42% /boot /dev/mapper/rhel-var 107G 473M 107G 1% /var /dev/mapper/rhel-home 6.5G 33M 6.5G 1% /home tmpfs 783M 0 783M 0% /run/user/1003 [root@wega99 ~]#
- Voila
Quellen:
http://ask.xmodulo.com/add-disks-to-lvm-volume-linux.html
https://www.thomas-krenn.com/de/wiki/LVM_vergr%C3%B6%C3%9Fern
SWAP Vergrössern in RHEL8
Doku: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/managing_storage_devices/getting-started-with-swap_managing-storage-devices#extending-swap-on-an-lvm2-logical-volume_getting-started-with-swap oder https://www.onesystems.ch/blog/lvm-festplatte-vergroessern-ohne-neue-partition/
Vergrössern der VM Disk
Procedure 15.1. Extending Swap on an LVM2 Logical Volume
Disable swapping for the associated logical volume:
# swapoff -v /dev/dm-1
Resize the Physical Volume (Falls dies nicht funktioniert mit dem pvresize, mit ubuntu CD starten und LVM aufziehen)
# pvresize /dev/sda2
Resize the LVM2 logical volume by 2 GB:
- lvresize /dev/rhel/swap -l +100%FREE
oder
Disks anzeigen mit lsblk, guckst du sda hat 250 gig, sda2 partition aber noch nicht:
[root@SAP-S4H-D-D2 ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 250G 0 disk ├─sda1 8:1 0 1G 0 part /boot └─sda2 8:2 0 23G 0 part ├─rhel-root 253:0 0 10G 0 lvm / ├─rhel-swap 253:1 0 2G 0 lvm ├─rhel-home 253:2 0 2G 0 lvm /home └─rhel-var 253:3 0 9G 0 lvm /var sr0 11:0 1 1024M 0 rom
sda2 Partition aufblasen mit parted /dev/sda resizepart 2 100% (2 ist die Partitionsnummer, siehe lsblk "8:2")
Guckst du lsblk, partition hat jetzt platz:
[root@SAP-S4H-D-D2 ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 250G 0 disk ├─sda1 8:1 0 1G 0 part /boot └─sda2 8:2 0 249G 0 part ├─rhel-root 253:0 0 10G 0 lvm / ├─rhel-swap 253:1 0 2G 0 lvm ├─rhel-home 253:2 0 2G 0 lvm /home └─rhel-var 253:3 0 9G 0 lvm /var sr0 11:0 1 1024M 0 rom Volume aufziehen mit pvresize /dev/sda2, dann weiter im Text wie wenn man extra Ubuntu gebootet hätte und wieder so weit ist :)
Format the new swap space:
# mkswap /dev/rhel/swap
Enable the extended logical volume:
# swapon -v /dev/mapper/rhel-swap
To test if the swap logical volume was successfully extended and activated, inspect active swap space:
$ cat /proc/swaps $ free -h
SWAP Vergrössern in RHEL9
Vergrössern der VM Disk in vSphere
Disable swapping for the associated logical volume:
# swapoff -v /dev/sda4
Resize the Physical Volume. Start server with ubuntu CD and resize volume. Reboot
Format the new swap space:
# mkswap /dev/rhel/swap
Enable the extended logical volume:
# swapon -v /dev/mapper/rhel-swap
To test if the swap logical volume was successfully extended and activated, inspect active swap space:
$ cat /proc/swaps $ free -h
iso mounten
sudo mount -o loop [Pfad\***.iso] /media/cdrom0
z.B.:
sudo mount -o loop ~/Desktop/ubuntu-9.04-alternate-i386.iso /media/cdrom0
Mount Error
Beim einstöpseln eines USB Laufwerkes wie z.B. ext. HD oder USB Stick erscheint ein Error "Unable to mount the volume "***" ". Da muss mal das NTFS log reseted werden.
sudo mount -t ntfs-3g -o force /dev/sdb1 /mnt sudo umount /mnt]] Dann die Platte mal abstöpseln und wieder anstöpseln - sollte anschliessend automatisch gemounted werden.
Try it
PS: Geht auch mit ntfsfix, aber dann wird auch ein Filesystemcheck von Windows durchgeführt, wenn man das nächste mal mit der Platte bootet.
Partitionen beim Start mounten
als root in der Datei /etc/fstab folgendes eintragen:
/dev/[partition] /media/[mountpoint] [filesystem] defaults 0 0
oder besser via UUID
UUID=[Partitions_UUID] /media/[mountpoint] [filesystem] defaults 0 0
um die UUID rauszufinden:
sudo blkid
z.B.:
/dev/sdc1 /media/VMware ntfs defaults 0 0
oder via UUID:
UUID=7f95b1aa-6b5a-497b-be18-86e36697849c /media/BackUp01_1TB_WD ext3 defaults 0 0
Netzwerkshares beim Starten mounten
samba installieren: sudo apt-get install cifs-utils falls nicht funzt sudo apt-get install smbfs (ältere Mounttools) Die Datei in /etc/fstab bearbeiten
CIFS
http://ubuntuforums.org/showthread.php?t=288534
//netbiosname/sharename /media/sharename cifs credentials=/root/.smbcredentials,iocharset=utf8,nounix,file_mode=0777,vers=2.1,dir_mode=0777,uid=1000 0 0
z.b.:
//172.16.93.90/Backup /media/backup cifs credentials=/root/.smbcredentials,iocharset=utf8,nounix,file_mode=0777,vers=2.1,dir_mode=0777,uid=1000 0 0 //10.1.1.226/Moviez /media/Moviez cifs credentials=/root/.smbcredentials-driver,iocharset=utf8,nounix,file_mode=0777,dir_mode=0777,vers=1.0 0 0
im Root ordner folgende Datei mit Inhalt erstellen:
.smbcredentials
username=Test
password=Test
in /media einen Ordner gem. fstab erstellen und mit drwxrwxrwx (40777) berechtigen
voila =)
NFS
nfs-common installieren Dann Link in fs.tab eintragen
z.B.:
192.168.6.13:/home /media/server nfs rw 0 0
DataDomain NFS Anbindungsparameter
ddname.test.ch:/data/col1/mtree1 /mnt/nfs_mountfolder nfs rw,hard,rsize=32768,wsize=32768,nolock 0 0
Laut einem Blog kann sogar folgendes gemacht werden
mount -t nfs -o hard,intr,nfsvers=3,tcp,rsize=1048600,wsize=1048600,bg datadomain:/data/col1/OracleBackup /OracleBackup
Link zum Blog robsteele.co
fstab ohne reboot neu einlesen
mount -a
iPot, iPhone, iPtouch in Ordner mounten
(zb. für ältere Programme wie GTKpod, Hipo, Ipod Photo uploader, ...usw.) siehe hier Mounten:
ifuse /mnt/ipod
Unmounten:
fusermount -u /mnt/ipod
Ubuntu 11.10 & iPhone ab iOS 5.0.1
Das iPhone ist eingesteckt und die Fehlermeldung erscheint In Terminal eingeben:
sudo apt-get install libimobiledevice-utils
iPhone Bilderschirm entsperren (wichtig!)
In Terminal eingeben:
idevicepair unpair && idevicepair pair
Wenn der Bildschirm gesperrt ist bekomme ich keinen Zugriff auf die iPhone Daten. Das entsperren muss allerdings nur beim ersten Mal sein, anschließend funktioniert es problemlos.
Mount - GUI Tools
ubuntu mountmanager: für ubuntu itrepid 9.04 gibt es eine neuere Version als die Repository Version
http://forum.ubuntuusers.de/post/2173052/
pyNeighborhood
ist im Repository
Ist für cifs und smb sehr geeignet
Daten kopieren/ verschieben
wget
wget -c --limit-rate=200k <URL http, https oder ftp>
kann mit Ctl+c abgebrochen werden und je nach Hostserver wieder am angefangenen Download weiter laden.
scp
scp von nach scp [Host]:/[Pfaad] []
Beispiel
scp sysadmin@hddeh4:/ddvar/ddfs.core.16176.1478155960.gz /tmp/hddeh4/
Disk / Partition Copy
mit dd (dump device) kann eine Festplatte blockweise auf eine andere geschrieben werden.
Beispiel: dd if=/dev/hda of=/dev/hdc
Beispiel:
- Starte die VM mit dem Ubuntu Live Image
- Mit dem gParted die Disks und Partitionen ansehen und die Devicenames notieren (z.B. Orig /dev/sda2 - Ziel /dev/sdb1)
- mit sudo dd in=/dev/sda2 of=/dev/sdb1 die Partition auf die zweite Platte (/dev/sdb) kopieren
- mit Gparted die Zielpartition auf die ganze grösse aufblasen: → menü → Partition → Check
- Falls nötig:
- die kopierte Partition hat natürlich die selbe UUID. Also muss evt noch die UUID geändert werden und im fstab eingepflegt werden.
- UUID wechseln: gPardet → Menü → Partition → Unmount → Menü → Partition → New UUID
- Neue UUID in /etc/fstab eintragen
Diskspace full
Kein Platz mehr?
Alte Snap Pakete löschen
Unter Ubuntu alte Snap-Pakete löschen
Über den exorbitaten Speicherbedarf von Ubuntus Paketverwaltungsprogramm Snap habe ich ja schon öfters gelästert. Aber erst jetzt ist mir eine weitere unangenehme Eigenheit aufgefallen: Snap speichert standardmäßig von jedem installierten Paket zwei Backups älterer Versionen. Nach Updates bleiben also ältere Versionen erhalten. Das verdreifacht den von Snap beanspruchten Speicherplatz!
Sie erkennen die alten Pakete am Status disabled.
snap list --all Name Version Rev Tracking Publisher Notes atom 1.31.0 199 stable snapcrafters disabled,classic atom 1.33.1 209 stable snapcrafters classic atom 1.31.2 202 stable snapcrafters disabled,classic core 16-2.36.3 6130 stable canonical✓ core core 16-2.35.2 5548 stable canonical✓ core,disabled core 16-2.35 5328 stable canonical✓ core,disabled core18 18 536 stable canonical✓ base core18 0.1 19 stable canonical✓ base,disabled gimp 2.10.6 47 stable snapcrafters disabled gimp 2.10.0 40 stable snapcrafters disabled gimp 2.10.8 94 stable snapcrafters - gnome-3-26-1604 3.26.0 74 stable/… canonical✓ - gnome-3-26-1604 3.26.0 70 stable/… canonical✓ disabled gnome-3-26-1604 3.26.0 64 stable/… canonical✓ disabled gnome-calculator 3.30.1 260 stable/… canonical✓ - gnome-calculator 3.30.0 222 stable/… canonical✓ disabled gnome-calculator 3.30.0 238 stable/… canonical✓ disabled gnome-characters 3.29.91 124 stable/… canonical✓ disabled gnome-characters 3.28.2 117 stable/… canonical✓ disabled gnome-characters 3.30.0 139 stable/… canonical✓ - gnome-logs 3.28.2 40 stable/… canonical✓ disabled gnome-logs 3.30.0 43 stable/… canonical✓ disabled gnome-logs 3.30.0 45 stable/… canonical✓ - gnome-system-monitor 3.28.2 54 stable/… canonical✓ disabled gnome-system-monitor 3.30.0 57 stable/… canonical✓ - gnome-system-monitor 3.28.2 51 stable/… canonical✓ disabled gtk-common-themes 0.1-4-g88bc1b2 818 stable canonical✓ - gtk-common-themes 0.1 701 stable canonical✓ disabled gtk-common-themes 0.1 319 stable canonical✓ disabled skype 8.34.0.78 66 stable skype✓ classic skype 8.32.0.44 60 stable skype✓ disabled,classic skype 8.31.0.92 57 stable skype✓ disabled,classic
Alte Pakete löschen
Um nicht mehr benötigte Pakete zu löschen, führen Sie im Terminal als Administrator (vorher sudo -s) die folgende Schleife aus:
snap list --all | awk '/disabled/{print $1, $3}' | while read snapname revision; do snap remove "$snapname" --revision="$revision" done
Versionsanzahl einstellen
Beginnend mit Snap 2.34 kann die Anzahl der sinnlosen Snap-Backups eingestellt werden. Allerdings lautet der kleinste zulässige Wert 2, was offensichtlich bereits die Defaulteinstellung ist.
sudo snap set system refresh.retain=2
Bleibt auf Systemen mit wenig Speicherplatz also nur ein cron-Script, das einmal wöchentlich wie oben beschrieben alle ‚disabled‘-Pakete rauswirft. Schöne neue Welt …
Snap Cache löschen
You can remove the files in /var/lib/snapd/cache without issue. Also there is no need to stop snapd before.
sudo sh -c 'rm -rf /var/lib/snapd/cache/*'
Journal verkleineren
https://linuxhandbook.com/clear-systemd-journal-logs/
1 Find out how much disk space /var/log/journal is consuming
sudo journalctl --disk-usage
Example output
Archived and active journals take up 123.0G in the file system.
2 Shrink/Reduce the folder size instantly/immediately
e.g. Delete old log files form /var/log/journal folder, reduce the folder size to 500MB or age max 1 month
sudo journalctl --vacuum-time=1m
oder
sudo journalctl --vacuum-size=500M
3 Control/Limit the disk space /var/log/journal can use
We can manually edit the configuration file /etc/systemd/journald.conf
sudo nano /etc/systemd/journald.conf
Add the following line at the bottom of the configuration file
SystemMaxUse=500M
or
MaxRetentionSec=1month
Ctrl + X, Y, Enter key to Save and Exit
Suchen / und Löschen
Find
Dateien Löschen, die älter sind als X Tage
find /path/to/files/* -mtime +X -exec rm {} \;
z.B. Apache Logs älter als 30 Tage
find /var/log/apache2/* -mtime +30 -exec rm {} \;
grep
grep [options] [path] -e [searchstring]
grep -rin / -e suechiwort
- -i stands for ignore case.
- -r or -R is recursive,
- -n is line number, and
- -w stands for match the whole word.
- -l (lower-case L) can be added to just give the file name of matching files.
- -e is the pattern used during the search
Netzwerkkonfiguration
Sehr gutes Doku:
Howto: Ubuntu Linux convert DHCP network configuration to static IP configuration
DVD Codecs und co.
Software
Webmin
webmin ist ein browserbasierendes Tool, um damit einen Linux-Server zu verwalten. Es lassen sich damit einen Grossteil der Aufgaben mittels grafischer Menüs erledigen.
Dazu lädt man sich ab der Website das richtige Paket herunter. Anschliessend wird ein Installationsversuch gestartet, der scheitern wird:
sudo dpkg -i <paketname>.deb
Da die Abhängigkeiten zu andern Paketen nicht automatisch erfüllt werden können, bricht die Installation ab. Da hilft ein Trick: Allerdings warne ich davor, denn dies ist wohl mehr ein Lausbubentrick als eine professionelle Weise, webmin zu installieren:
sudo apt-get install -f
Damit versucht das System, die Pakete und deren Abhängigkeiten zu reparieren und holt sich die Pakete nun doch, die in Abhängigkeit zu webmin stehen. Die Installation glückt so aber tip top und bis jetzt jedes mal. Damit steht webmin sofort unter dem Port 10000 und unter SSL zur Verfügung:
https://IP_oder_Adresse_des_Servers:10000
Früher war es noch notwendig, den Benutzer root zurechtzubiegen, um sich an webmin anzumelden. Heute funktioniert das ohne, es reicht, wenn man sich mit einem Benutzer, der sudo-Rechte besitzt, anmeldet.
Ausserdem ist es nicht notwendig, dass ein Webserver auf dem Server läuft. webmin bringt selbst alles mit, damit es per Browser angesteuert werden kann. Und damit steht ein umfassendes Tool zur Verwaltung des Servers zur Verfügung!
Text ursprünglich von ubuntublog.ch
neu ab 11.10 im terminal
Install webmin on ubuntu 11.04 (Natty) server
Edit /etc/apt/sources.list file
sudo vi /etc/apt/sources.list
Add the following lines
deb http://download.webmin.com/download/repository sarge contrib
deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib
Save and exit the file
Now you need to import GPG key
wget http://www.webmin.com/jcameron-key.asc
sudo apt-key add jcameron-key.asc
Update the source list
sudo apt-get update
Install webmin
sudo apt-get install webmin
Now you need to access webmin using http://serverip:10000/ once it opens you should see similar to the following screen
Probleme mit VMWare Server 2.0.* und VMWare Konsole via Firefox
Das Plugin lässt sich doch auch ohne den Firefox starten:
- Man suche vmware-vmrc im Directory .mozilla
- Man passe ggf. Rechte an und / oder starte mit bash, also bash vmrare-vmrc
Syntax:
vmware-vmrc -h <hostname:port> -u <username> -p <password>
Beispiel:
bash vmware-vmrc -h localhost:8333 -u driver -p geheim
oder
man lege einen Starter an und gebe dies ein(Pfad anpassen):
/home/driver/.mozilla/firefox/fbxco40n.default/extensions/VMwareVMRC@vmware.com/plugins/vmware-vmrc -h localhost:8333 -u driver -p geheim
ACHTUNG! ...um sicher zu gehen, dass niemand das PW findet, kann auch "-u driver -p geheim" weggelassen werden. Mann muss dies nach dem Start in einem Gui eingeben...
SAMBA
Einzelne Hosts berechtigen ohne Useranmeldung
smb.conf
#smb.conf is the main Samba configuration file. You find a full commented #version at /usr/share/doc/packages/samba/examples/smb.conf.SUSE if the #samba-doc package is installed. # Date: 2013-12-13 [global] workgroup = WORKGROUP passdb backend = tdbsam printing = cups printcap name = cups printcap cache time = 750 cups options = raw map to guest = Bad User include = /etc/samba/dhcp.conf logon path = \\%L\profiles\.msprofile logon home = \\%L\%U\.9xprofile logon drive = P: usershare allow guests = Yes security = share ; unix extensions = no ### SQL Backup Shares - Tests ### include = /etc/samba/shares/shares.conf
In der includeten shares.conf können pro Share verschiedene Einstellungen gemacht werden.
Bei wenigen Shares können die Shareangaben auch gleich direkt in der smb.conf gepflegt werden
/etc/samba/shares/shares.conf
[test] comment = Temporary file space path = /tmp/test read only = no browseable = yes writeable = yes public = yes [v05zck] comment = Test Share zum Einrichttest path = /mnt/nfs_cifs_sql/v05zck browseable = yes read only = no create mode = 0777 public = yes hosts deny = ALL hosts allow = 172.27.41.195 [v06tst] comment = for SLQ Server v06tst path = /mnt/nfs_cifs_sql/hhh browseable = yes read only = no create mode = 0777 public = yes hosts deny = ALL hosts allow = 172.27.41.94 172.27.41.201 172.27.41.195
MAC Adressen an ein IF Name binden
SUSE
vi /etc/udev/rules.d/70-persistent-net.rules
Cron
Cron Time Generator:
https://www.freeformatter.com/cron-expression-generator-quartz.html
Auflisten der cronjobs mit Timers
systemctl list-timers
Cron configs:
/etc/crontab: Dies ist die Haupttabelle für auszuführende Cron-Jobs aus Sicht des Systems. Sie wird vom Administrator des Systems gepflegt.
/etc/cron.d/: In diesem Ordner können zusätzliche Dateien abgelegt werden, die gleichrangig zur Haupttabelle, aber unabhängig von dieser abgearbeitet werden; d.h.u.a. Definitionen von Umgebungsvariablen aus der Haupttabelle gelten nicht in diesen Nebentabellen. Diese Nebentabellen haben dasselbe Format wie die Haupttabelle. Software-Pakete, welche Cron benutzen, legen in diesem Ordner ihre spezielle Konfiguration ab.
crontab
Beiispiel:
[root@server ~]$ vi /etc/crontab SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root # For details see man 4 crontabs # Example of job definition: # .---------------- minute (0 - 59) # | .------------- hour (0 - 23) # | | .---------- day of month (1 - 31) # | | | .------- month (1 - 12) OR jan,feb,mar,apr ... # | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat # | | | | | # * * * * * user-name command to be executed 0 1 * * * root find '/home/ucsftp/voice/logs/' -name "C*" -mtime +30 -type f -delete 0 1 * * * root find '/home/ucsftp/netapp/' -name "*7z" -mtime +3 -type f -delete 0 1 * * * root find '/home/ucsftp/netapp/' -name "*bkp" -mtime +7 -type f -delete 0 1 * * * root find '/home/ucsftp/system_backups/ise/conf/' -name "*.gpg" -mtime +15 -type f -delete 0 1 * * * root find '/home/ucsftp/system_backups/wlc03/conf/' -name "WLC03*" -mtime +365 -type f -delete 0 6 * * * root /usr/local/scripts/checkuclog.sh 0 6 * * * root /usr/local/scripts/checkucbackup.sh
Run cron as specific user
#<timing> <user> <command> 11 * * * * root /usr/lib/command
Cronjob manuell starten
sh /etc/cron.daily/cronjob
Startup mit Cron
ab Ubuntu 17.10
Put the script in the appropriate user's cron table (i. e. the crontab) with a schedule of @reboot.
A user can edit its cron table with
crontab -e
An example which will run /path/to/script.sh at startup:
@reboot /path/to/script.sh
If you need to run it as root, don't use @reboot sudo /path/to/script.sh; use sudo crontab -eu root to edit root's crontab.
Cron Jobs finden auch wenn nur von User
ll /var/sppl/cron/
Gerät in Standby versetzen und wieder aufwecken mit cron
crontab -e
* 18 * * * rtcwake -m mem -s 46800
Versetzt das Gerät um 18 Uhr in den Standby und weck es um 07 Uhr wieder auf
Bootloader / Grub
Loginscreen resolution vergrössern
sudo nano /etc/default/grub
Use the down arrow or Page Down until you see the line that looks like this:
#GRUB_GFXMODE=640x480
Below that line, enter the following, substituting the 1920x1080 for a supported resolution:
GRUB_GFXMODE=1920x1080 GRUB_GFXPAYLOAD_LINUX=keep
To save your changes, hit Ctrl+o, with "o" as in Ohio, not zero. To exit nano, hit Ctrl+x. Now, update grub:
sudo update-grub
monitorix
sudo apt install monitorix
add a Firewall rule on port tcp/8080
http://localhost:8080/monitorix
Conky Systemmonitor
Conky ist ein vielseitiger Systemmonitor für den Desktop.
Config File /etc/conky/conky.conf
-- vim: ts=4 sw=4 noet ai cindent syntax=lua --[[ Conky, a system monitor, sed on torsmo Any original torsmo code is licensed under the BSD license All code written since the fork of torsmo is licensed under the GPL Please see COPYING for details Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen Copyright (c) 2005-2012 Brenden Matthews, Philip Kovacs, et. al. (see AUTHORS) All rights reserved. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. ]] conky.config = { alignment = 'top_right', background = false, border_width = 1, cpu_avg_samples = 2, default_color = 'white', default_outline_color = 'white', default_shade_color = 'white', draw_borders = false, draw_graph_borders = true, draw_outline = false, draw_shades = false, use_xft = true, font = 'DejaVu Sans Mono:size=12', gap_x = 5, gap_y = 60, minimum_height = 5, minimum_width = 5, net_avg_samples = 2, no_buffers = false, out_to_console = false, out_to_stderr = false, extra_newline = false, own_window = true, own_window_class = 'Conky', own_window_type = 'desktop', stippled_borders = 0, update_interval = 1.0, uppercase = false, use_spacer = 'none', show_graph_scale = false, show_graph_range = false, own_window_argb_visual = true, own_window_argb_value = 0, double_buffer = true, } conky.text = [[ ${color white} ${alignc} ${font Monospace:size=20} $nodename $font ${alignc} ${execi 999999 lsb_release -ds} ${color white} ${alignc} ${font Monospace:size=7} $sysname $kernel on $machine $font $hr ${color grey}Logged-In Users:$color ($user_number) ${user_names} ${color grey}Usercon on Port 22(ssh): $color ${tcp_portmon 22 22 count} ${color grey}Usercon on Port 80 (http): $color ${tcp_portmon 80 80 count} ${color grey}Usercon on Port 443 (https): $color ${tcp_portmon 443 443 count} $hr ${color grey}Uptime:$color $uptime ${color grey}RAM Usage:$color $mem/$memmax - $memperc% ${membar 4} ${color grey}Swap Usage:$color $swap/$swapmax - $swapperc% ${swapbar 4} ${color grey}CPU Usage:$color $cpu% ${cpubar 4} ${color grey}CPU Frequency (in GHz):$color $freq_g ${color grey}Processes:$color $processes ${color grey}Running:$color $running_processes $hr ${color grey}File systems: / $color${fs_used /}/${fs_size /} ${fs_bar 6 /} $hr ${color grey}Networking: ${color grey}IP: $color ${addr ens192} Down:$color ${downspeedf ens192} k/s ${offset 40}${color grey}Up:$color ${upspeedf ens192} k/s${color grey} ${downspeedgraph ens192 32,120 efefef 171717 100} ${offset 40} ${upspeedgraph ens192 32,120 efefef 171717 100} $hr ${color grey}Name PID CPU% MEM% ${color lightgrey} ${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1} ${color lightgrey} ${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2} ${color lightgrey} ${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3} ${color lightgrey} ${top name 4} ${top pid 4} ${top cpu 4} ${top mem 4} ${hr 2} ${color grey}ESTABLISHED Connections ${offset 75%}${font Ubuntu Mono:size=9}${color lightgrey}Inbound: ${color white}${tcp_portmon 1 32767 count} ${color lightgrey}Outbound: ${color white}${tcp_portmon 32768 61000 count} ${color lightgrey}Total: ${color white}${tcp_portmon 1 65535 count} ${color slate grey}${font Ubuntu Mono:size=9}Process Remote IP L-Port R-Port ${color lightgrey}${texeci 5 netstat -atulpen | grep 'ESTABLISHED' | sed -r 's|.*.[0-9.]+:([0-9]*)\s*([0-9.]+):([0-9]+)[^/]+/([a-zA-Z0-9]*)|\4 \2 \1 \3|' | awk '{printf("%-15s %-20s %-10s %-10s\n",$1,$2,$3,$4)}'} ]]
-- vim: ts=4 sw=4 noet ai cindent syntax=lua --[[ Conky, a system monitor,
sed on torsmo
Any original torsmo code is licensed under the BSD license
All code written since the fork of torsmo is licensed under the GPL
Please see COPYING for details
Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen Copyright (c) 2005-2012 Brenden Matthews, Philip Kovacs, et. al. (see AUTHORS) All rights reserved.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. ]]
conky.config = {
alignment = 'top_right', background = false, border_width = 1, cpu_avg_samples = 2, default_color = 'white', default_outline_color = 'white', default_shade_color = 'white', draw_borders = false, draw_graph_borders = true, draw_outline = false, draw_shades = false, use_xft = true, font = 'DejaVu Sans Mono:size=12', gap_x = 5, gap_y = 60, minimum_height = 5, minimum_width = 5, net_avg_samples = 2, no_buffers = false, out_to_console = false, out_to_stderr = false, extra_newline = false, own_window = true, own_window_class = 'Conky', own_window_type = 'desktop', stippled_borders = 0, update_interval = 1.0, uppercase = false, use_spacer = 'none', show_graph_scale = false, show_graph_range = false, own_window_argb_visual = true, own_window_argb_value = 0, double_buffer = true,
}
conky.text = [[ ${color white} ${alignc} ${font Monospace:size=20} $nodename $font ${alignc} ${execi 999999 lsb_release -ds} ${color white} ${alignc} ${font Monospace:size=7} $sysname $kernel on $machine $font $hr ${color grey}Logged-In Users:$color ($user_number)
${user_names}
${color grey}Usercon on Port 22(ssh): $color ${tcp_portmon 22 22 count} ${color grey}Usercon on Port 80 (http): $color ${tcp_portmon 80 80 count} ${color grey}Usercon on Port 443 (https): $color ${tcp_portmon 443 443 count} $hr ${color grey}Uptime:$color $uptime ${color grey}RAM Usage:$color $mem/$memmax - $memperc% ${membar 4} ${color grey}Swap Usage:$color $swap/$swapmax - $swapperc% ${swapbar 4} ${color grey}CPU Usage:$color $cpu% ${cpubar 4} ${color grey}CPU Frequency (in GHz):$color $freq_g ${color grey}Processes:$color $processes ${color grey}Running:$color $running_processes $hr ${color grey}File systems:
/ $color${fs_used /}/${fs_size /} ${fs_bar 6 /}
$hr ${color grey}Networking: ${color grey}IP: $color ${addr ens192} Down:$color ${downspeedf ens192} k/s ${offset 40}${color grey}Up:$color ${upspeedf ens192} k/s${color grey} ${downspeedgraph ens192 32,120 efefef 171717 100} ${offset 40} ${upspeedgraph ens192 32,120 efefef 171717 100} $hr ${color grey}Name PID CPU% MEM% ${color lightgrey} ${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1} ${color lightgrey} ${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2} ${color lightgrey} ${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3} ${color lightgrey} ${top name 4} ${top pid 4} ${top cpu 4} ${top mem 4} ${hr 2} ${color grey}ESTABLISHED Connections ${offset 75%}${font Ubuntu Mono:size=9}${color lightgrey}Inbound: ${color white}${tcp_portmon 1 32767 count} ${color lightgrey}Outbound: ${color white}${tcp_portmon 32768 61000 count} ${color lightgrey}Total: ${color white}${tcp_portmon 1 65535 count}
${color slate grey}${font Ubuntu Mono:size=9}Process Remote IP L-Port R-Port ${color lightgrey}${texeci 5 netstat -atulpen | grep 'ESTABLISHED' | sed -r 's|.*.[0-9.]+:([0-9]*)\s*([0-9.]+):([0-9]+)[^/]+/([a-zA-Z0-9]*)|\4 \2 \1 \3|' | awk '{printf("%-15s %-20s %-10s %-10s\n",$1,$2,$3,$4)}'} ]]
Autostart einrichten:
oder für alle Benutzer
/etc/xdg/autostart/ mit Root-Rechten eine .desktop-Datei für das zu startende Programm anlegen.
[Desktop Entry] Type=Application Name=Conky Exec=conky
WC Word Count
WC dient zum Zählen von Wörtern, Zeichen und Bytes in Textdateien.
https://wiki.ubuntuusers.de/wc/
Host SMBus controller bus not enabled
Beim starten von Ubuntu 18.04 auf vmware kommt die Meldung:
Host SMBus controller bus not enabled
First, add this line in your vmx file to increase the boot time to 50s
bios.bootDelay = "50000"
Start the VM, hold the left shift key down, then hit Enter.
In the grub menu, choose Advanced options for Ubuntu -> Recovery mode. Once the system boots, choose 'Root' to drop into a root shell.
In the root shell, enter the following commands
mount -o remount,rw / nano /etc/modprobe.d/blacklist.conf
go down a few lines (almost anywhere) and enter the line
blacklist i2c-piix4
Then press ctrl+o to save the file, and ctrl+x
Run sudo update-initramfs -u
Finally, enter the command
reboot
SNMP
SNMP Service fail
Bei einem Fail des SNMP Services Starts kann es sein dass IPv6 deaktiviert wurde. Also SNMP Konfig ändern
sudo nemo /etc/snmp/snmpd.conf
Zeile
agentAddress udp:161,udp6:[::1]:161
ändern in
agentAddress udp:161
sudo systemctl start snmpd
File Explorer
Testen: Sunflower 0.4
Root Zertifikat inportieren
Aufpassen... genau arbeiten sonnst funzts ned.
sudo mkdir /usr/share/ca-certificates/z.b.company/
Zertifikat import:
sudo mv /home/user/Downloads/Root.crt /usr/share/ca-certificates/z.b.company/
oder
sudo nano /usr/share/ca-certificates/z.b.company/Root.crt
und den Inhalt des Zertis einfügen oder mit wget ab irgend eiem Server holen
Zertifikat in CA Config aufnehmen:
sudo dpkg-reconfigure ca-certificates
ask -> ok neues Zerti anwählen (aktivieren) und auf OK
Im Output sollte nunn min ein Zerti added werden:
oder manuel:
sudo nano /etc/ca-certificates.conf
am ende der Konfigdatei folgendes eintragen:
z.b.company/IT-Issuing-CertificationAuthority.crt
sudo update-ca-certificates
Test:
awk -v cmd='openssl x509 -noout -subject' '/BEGIN/{close(cmd)};{print | cmd}' < /etc/ssl/certs/ca-certificates.crt | grep z.b.company subject=C = CH, ST = BE, O = Company, CN = IT-Issuing-CertificationAuthority setup@ubuntu2004-im:~$
wenn kein Output, dann schlug was fehl!
Services Daemons
Restart aufter Fail
Service kann mit Restart=on-failure und RestartSec=1s zum restarten gebracht werden
/etc/systemd/system/***.service
oder
/lib/systemd/system/***.service
beispiel: sudo nano /lib/systemd/system/snmpd.service
[Unit] Description=Your Daemon Name [Service] ExecStart=/path/to/executable Restart=on-failure RestartSec=1s [Install] WantedBy=multi-user.target
dann noch ein
systemctl daemon-reload
um die Config neu zu laden
CAD
Onshape
CAD für Einsteiger
Autostart Tablet
rtcwake
sudo apt install rtcwake
sudo crontab -e
rtcwake -m mem -u -t $(date +\%s -d "tomorrow 06:00")
or
stops @ 18:00 and wakeup at 07:00
* 18 * * * rtcwake -m mem -s 46800
NTP
NTP Einstellungen:
sudo nano /etc/systemd/timesyncd.conf
NTP=time1.server.net time2.server.net FallbackNTP=time2.server.net time1.server.net
eintragen.
AppImage
How to Add AppImage Application to Menu in Ubuntu
Install Gear Lever
CENTOS Update error
in a awx container it is working
cd /etc/yum.repos.d/
Run
sudo sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* sudo sed -i 's|#baseurl=http://mirror.centos.org%7Cbaseurl=http://vault.centos.org%7Cg' /etc/yum.repos.d/CentOS-* sudo yum update -y
Links
- Verzeichnis
- ← Zurück zu Überseite: Hauptseite