Linux: Unterschied zwischen den Versionen

Aus Zovis Wikili
Wechseln zu: Navigation, Suche
(Hardware)
(How to Add AppImage Application to Menu in Ubuntu)
 
(106 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 19: Zeile 19:
  
 
== Allgemeines ==
 
== 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 [https://help.ubuntu.com/community/Tasksel Tasksel Ubuntu Doc.] - [http://www.unixmen.com/linux-distributions/4-ubuntu/1239-install-lamp-with-1-command-in-ubuntu-1010-maverick-meerkat Guideline]
 
* '''tasksel''' → PM Quick-Installtool für LAMP, DNS Server, und noch vieles mehr [https://help.ubuntu.com/community/Tasksel Tasksel Ubuntu Doc.] - [http://www.unixmen.com/linux-distributions/4-ubuntu/1239-install-lamp-with-1-command-in-ubuntu-1010-maverick-meerkat Guideline]
Zeile 34: Zeile 39:
 
* Hipo - iPod manager → PM
 
* Hipo - iPod manager → PM
  
* K3b, (evt auch GnomeBaker) → PM - Brennproggies
+
* Brennproggies
 +
 
 +
:* K3b, (evt auch GnomeBaker) → PM - Brennproggies
 +
 
 +
:* Brasero PM
  
 
:* [https://help.ubuntu.com/community/LightScribe LightScribe]
 
:* [https://help.ubuntu.com/community/LightScribe LightScribe]
Zeile 93: Zeile 102:
  
 
* Visio clon - 1000mal besser als Visio & OpenSource -> https://draw.io
 
* Visio clon - 1000mal besser als Visio & OpenSource -> https://draw.io
 +
 +
* Notepadqq - PM Notepad++ for Linux
  
 
== Backup / Sync ==
 
== 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
 
* ReaR http://relax-and-recover.org/ BareMetal Desaster recovery tool
Zeile 113: Zeile 125:
  
 
* QT-Fsarchiver - GUI Backup und Clone Tool für Partitionen - nice für ubuntu isostick https://wiki.ubuntuusers.de/qt-fsarchiver/
 
* QT-Fsarchiver - GUI Backup und Clone Tool für Partitionen - nice für ubuntu isostick https://wiki.ubuntuusers.de/qt-fsarchiver/
 +
 +
* HDDs Blockweise Sichern - [https://rescuezilla.com/ 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
  
  
Zeile 154: Zeile 176:
 
=== Löschen einer SSD ===
 
=== Löschen einer SSD ===
 
Siehe http://www.pcwelt.de/ratgeber/Datensicherheit-6581465.html
 
Siehe http://www.pcwelt.de/ratgeber/Datensicherheit-6581465.html
 +
 +
BleachBit --> PM
 +
 +
Gnome Disk
 +
 +
DBAN - Linux Distri auf iso
 +
 
<br /><br /><br /><br />
 
<br /><br /><br /><br />
  
Zeile 188: Zeile 217:
  
 
* MusE - PM - MIDI/Audio-Sequenzer und -Bearbeitungsprogramm
 
* MusE - PM - MIDI/Audio-Sequenzer und -Bearbeitungsprogramm
 +
 +
* Testen: SpotRec Um spotify Aufnamen zu machen
  
 
== Video ==
 
== Video ==
  
* MakeMKV - MKV erzeugen PM
+
* MakeMKV - MKV erzeugen PM - https://forum.makemkv.com/forum/viewtopic.php?f=5&t=1053 for the beta key
  
 
* DVD abspielen - siehe [https://help.ubuntu.com/community/Medibuntu Medibuntu]
 
* DVD abspielen - siehe [https://help.ubuntu.com/community/Medibuntu Medibuntu]
Zeile 197: Zeile 228:
 
* DVD95 - Ganz easy Sicherheitskopien erstellen &#8594; PM
 
* DVD95 - Ganz easy Sicherheitskopien erstellen &#8594; PM
  
* DeVeDe - Kuuler convertierer - DVD &#8594; PM\\ nice!
+
* DeVeDe - Kuuler convertierer - DVD &#8594; PM\\ nice! Können direkt DVDs ab MKVs erstellt werden.
  
 
* PiTiVi &#8594; Video schneide Progi &#8594; einstellung für typo3-flash: format:FLV, grösse: 400x300, skalieren: 100%, 25fps, codec: x264enc, audio: l.a.m.e. mp3\\
 
* PiTiVi &#8594; Video schneide Progi &#8594; einstellung für typo3-flash: format:FLV, grösse: 400x300, skalieren: 100%, 25fps, codec: x264enc, audio: l.a.m.e. mp3\\
Zeile 224: Zeile 255:
  
 
TinTii - Den Bilern Farbe entnehmen oder verleihen
 
TinTii - Den Bilern Farbe entnehmen oder verleihen
 +
 +
 +
=== Screenshot ===
 +
 +
* Geiles Tool Flameshot  &#8594; PM
 +
sudo apt install flameshot
 +
 +
* Shutter - Umständlich aber kann viel
  
 
== Games ==
 
== Games ==
Zeile 285: Zeile 324:
 
* [http://www.webupd8.org/2017/02/screenlets-desktop-widgets-fixed-for.html Screenlets](Desktop Widgets) Fixed For Ubuntu 16.04, Available In PPA
 
* [http://www.webupd8.org/2017/02/screenlets-desktop-widgets-fixed-for.html Screenlets](Desktop Widgets) Fixed For Ubuntu 16.04, Available In PPA
 
* Lshw Hardware anzeigen - noch checken
 
* Lshw Hardware anzeigen - noch checken
 +
* sudo hardinfo in PM - Grafische Hardware Anzeige
  
 
== Fun ==
 
== Fun ==
Zeile 331: Zeile 371:
  
 
* 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/
 
* 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 =
 
= Zovis Install String =
Zeile 347: Zeile 389:
 
= FAQ =
 
= FAQ =
  
== 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
 
<br><br><br>
 
  
Mit folgenden Befehl können Sie den privaten Schlüssel aus einer PFX-Datei in eine PEM-Datei extrahieren:
+
== gvfsd-admin daemon authentication Window not disappear ==
openssl pkcs12 -in filename.pfx -nocerts -out key.pem
+
 
 +
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.
  
  
Nur das Zertifikat exportieren:
 
openssl pkcs12 -in filename.pfx -clcerts -nokeys -out cert.pem
 
  
 +
== Grosse Files generieren ==
  
Entfernen des Kennworts aus dem extrahierten privaten Schlüssel:
 
openssl rsa -in key.pem -out server.key
 
  
== Automatisation ==
+
fallocate -l 100G filename
=== Ansible ===
+
 
docs.ansible.com
+
== SSSD Active Directory integration von Linux ==
 +
=== Infos ===
 +
 
 +
https://www.freeipa.org/images/c/cc/FreeIPA33-sssd-access-control.pdf
 +
 
 +
----
  
awx wäre ein zentraler manager für ansible
+
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.
  
==== Playbook ====
+
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.
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
 
  
 +
[Configuration]
 +
AdminIdentities=unix-group:sudo;unix-group:admin;unix-group:EngineeringSudo
  
Beispiel User create und in sudoers wheel einpflegen
+
This works by making your AD sudo group an "Administrator" as far as PolKit is concerned.
  
---
+
----
- hosts: all
+
Gute Anleitung von hier
  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 ====
+
https://ubuntu.com/server/docs/service-sssd
alsible-inventory --graph
 
  
---
 
ypsomed:
 
  vars:
 
  ansible_user: root
 
  
---
 
test:
 
  hosts:
 
    me:
 
      ansible_connection: local
 
  
== Docker ==
 
  
  
=== Aufbau ===
+
=== Installationsanleitung ===
[[Datei:docker_overview.jpg]]
+
Install the following packages:
  
=== Persistent Volumes einbinden ===
+
sudo apt install sssd-ad sssd-tools realmd adcli
  
# 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 ===
+
Join the domain
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 ===
+
We will use the realm command, from the realmd package, to join the domain and create the sssd configuration.
  
docker start -ti [ContainerName]
+
Let’s verify the domain is discoverable via DNS:
-ti um in den Container mit dem Terminal zu verbinden.
 
  
 +
$ 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
  
=== Port Weiterleitung ===
+
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.
  
Port von extern nach inter mit den definierten Ports
+
Now let’s join the domain:
  -p 3306:3306 -p 80:80
+
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
  
  siehst du denn mit docker ps
+
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
  
  
  
=== Docker Images ===
+
[[Datei:sssd02.png]]
traefik iste ein toller reverseproxy
 
  
=== Netzwerk ===
+
Konfiguration:
Standard ist Bridge Network
+
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
  
 +
[[Datei:sssd03.png]]
  
 +
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
  
=== Docker Image IP und Infos sehen
+
  sudo systemctl restart sssd
  docker inspect e113fa732eca
 
  
== Prozess Management ==
+
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:~$
  
  
=== ps ===
 
für mein Login:
 
ps
 
  
alle Prozesse:
+
Automatic home directory creation:
  ps -ef
+
  sudo pam-auth-update --enable mkhomedir
  
top
+
Kerberos Tickets:
  
 +
sudo apt install krb5-user
 +
Default Kerberos version5 realm:
 +
CORP.ITSROOT.BIZ
 +
[[Datei:sssd04.png]]
  
=== dystemd ===
+
Test einer smbclient verbindung mit AD User:
Überblick der running Services
+
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
  
  systemctl --state=running
+
Nun sollten wir ein Kerberos Ticket haben:
  UNIT                        LOAD  ACTIVE SUB    DESCRIPTION
+
  neku1opr@ubuntu2004-im:~$ klist
  session-843.scope            loaded active running Session 843 of user neku1adm
+
Ticket cache: FILE:/tmp/krb5cc_720201236_Gniy71
  auditd.service              loaded active running Security Auditing Service
+
Default principal: neku1opr@CORP.ITSROOT.BIZ
  chronyd.service              loaded active running NTP client/server
+
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
  
Target sind nun die alten Runlevels
+
[[Datei:sssd05.png]]
  
 +
Domainusers as AdminIdentities
  
Dependensylist eines Services:
+
Bitte noch '''unix-group:CORP-LinuxServerAdmins;''' in folgendem Configfile hinzufügen.
[root@tiaki02 ~]# systemctl list-dependencies sshd
+
  sudo nano /etc/polkit-1/localauthority.conf.d/51-ubuntu-admin.conf
sshd.service
 
  ● ├─sshd-keygen.service
 
● ├─system.slice
 
  
 +
[Configuration]
 +
AdminIdentities=unix-group:sudo;unix-group:admin;unix-group:CORP-LinuxServerAdmins;
 +
<br><br><br><br><br>
 +
----
  
Definition anzeigen eines Services:
+
== Update Upgrade 'n Stuff ==
[root@tiaki02 ~]# systemctl cat sshd
+
=== Ubuntu 18.04 auf 20.04 schlägt fehl beim do-release-upgrade ===
# /usr/lib/systemd/system/sshd.service
+
 
[Unit]
+
  deb http://ch.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
Description=OpenSSH server daemon
+
in '''/etc/apt/sources.list''' hinzufügen
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 ===
+
Dies versuchen...wenns nicht klappt unten weiter machen:
  lsof | grep etc
+
  sudo apt update && sudo apt install update-manager-core
oder
+
dann den eintrag wieder entfernen
lsof /etc/ssh/
 
  
== Loging ==
+
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
  
=== Logs allgemein ===
+
sudo apt install clamav-daemon clamtk-gnome && sudo systemctl is-enabled clamav-daemon && sudo systemctl is-enabled clamav-freshclam
/var/log/
+
je nach dem noch externe ppas wieder aktivieren
  
  /var/log/audit
+
----
 +
<br><br><br><br>
 +
=== check number of pending regular updates ===
 +
==== RedHat ====
 +
  yum updateinfo list --quiet | wc -l
  
/var/Log/messages alles ausser die definierten logs
+
Nur Security Updates:
   
+
  yum updateinfo list sec --quiet | wc -l
  
journalctl --since 9:05:00 --until 12:00:00
+
==== Ubuntu ====
-p nur warnings
 
-u sshd  sehr Hilfreich
 
-b bootlogs
 
-b -1 bootlogs vorletster boot
 
  
=== Suche ===
+
  /usr/lib/update-notifier/apt-check 2>&1 | cut -d ';' -f 1
  less FILE und dann "/" für Suche
 
Taste n für next
 
Schift+G Ende vom Log
 
  
 +
Nur Security Updates:
 +
/usr/lib/update-notifier/apt-check 2>&1 | cut -d ';' -f 2
  
=== last ===
+
----
Loging History
 
last
 
  
 +
<br><br><br><br>
  
  
== Networking ==
+
=== last time since the system was updated ===
  
ip addr
+
==== RedHat ====
ip l Physikalisch Links
+
  rpm -qa --queryformat '%{installtime} (%{installtime:date}) %{name}\n' | sort -n | tail -n 1
  ip r route
 
  
 +
==== Ubuntu ====
 +
find /boot/ini* -printf '%Cs\n' | head -1
  
/etc/sysconfig/network-scripts/ifcfg-ens192
+
<br><br><br><br>
  
nmcli con - Connections anzeigen, es können mehrere Connections pro IF angelegt werden
+
== Zertifikate Certificates ==
nmcli d - Devices
+
PFX-Datei in PEM-Datei konvertieren
+
Konvertierung in eine kombinierte PEM-Datei
=== Hostname ===
 
hostnamectl
 
  
  set-hostnamectl tsetserver2
+
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
 +
<br><br><br>
  
 +
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
  
=== timedatectl ===
 
Zeitzonen einstellen
 
  
 +
Nur das Zertifikat exportieren:
 +
openssl pkcs12 -in filename.pfx -clcerts -nokeys -out cert.pem
  
=== Tools ===
 
  
==== Telnet ====
+
Entfernen des Kennworts aus dem extrahierten privaten Schlüssel:
  telnet google.ch:80
+
  openssl rsa -in key.pem -out server.key
GET /HTML1.1
 
  
telnet localhost:22
+
== Automatisation ==
 +
=== Ansible ===
 +
docs.ansible.com
  
=== netcat ===
+
awx wäre ein zentraler manager für ansible
nc localhost 22
 
  
  nc localhost 1-100
+
==== Playbook ====
 
+
Beispiel installiere Updates und reboote falls nötig
MiniChat =)
+
---
nc -l 4444 auf dem einen Host
+
  - hosts: all
auf dem anderen Host
+
  tasks:
nc IP Port
+
    - name: updating the System
nc 172.1.1.23 4444
+
      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
  
=== nmap ===
+
---
  nmap localhost -
+
  - 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
  
=== ethtool ===
+
---
  ethtool ens192
+
  test:
 +
  hosts:
 +
    me:
 +
      ansible_connection: local
  
 +
== Docker ==
  
  
== Proxy ==
+
=== Aufbau ===
 +
[[Datei:docker_overview.jpg]]
  
=== Proxy System weit aktivieren ===
+
=== Persistent Volumes einbinden ===
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
+
# 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
  
  http_proxy=http://192.168.43.100:3128/
+
=== SELinux Anpassungen für Doker zügs ===
  https_proxy=https://192.168.43.100:3128/
+
Persistent Volumes ausserhalb Docker SELinux berechtigen
 +
  chcon -Rt svirt_sandbox_file_t /Dateipfad
 +
oder neu
 +
  chcon -Rt container_file_t /Dateipfad
  
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.
+
=== Starten eines Docker Containers ===
  
  sudo netplan apply
+
  docker start -ti [ContainerName]
 +
-ti um in den Container mit dem Terminal zu verbinden.
  
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
+
=== Port Weiterleitung ===
--2019-03-23 12:34:05--  http://google.com/
 
Connecting to 192.168.43.100:3128...
 
  
sudo apt update
+
Port von extern nach inter mit den definierten Ports
  0% [Connecting to 192.168.43.100 (192.168.43.100)] [Connecting to 192.168.43.100 (192.168.43.100)]...
+
  -p 3306:3306 -p 80:80
  
 +
  siehst du denn mit docker ps
  
=== 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;
+
=== Docker Images ===
 +
traefik iste ein toller reverseproxy
  
http_proxy=http://Username:Password@192.168.43.100:3128/
+
=== Netzwerk ===
https_proxy=https://Username:Password@192.168.43.100:3128/
+
Standard ist Bridge Network
  
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 ==
+
=== Docker Image IP und Infos sehen
 +
docker inspect e113fa732eca
  
== Security ==
+
== Prozess Management ==
  
=== SELinux / Apparmor ===
 
  
 +
=== ps ===
 +
für mein Login:
 +
ps
  
User die in SELinux eingebunden sind.
+
alle Prozesse:
semanage user -l
+
ps -ef
 +
 
 +
top
  
  
Wichtig sind
+
=== dystemd ===
* fcontext
+
Überblick der running Services
* boolean
 
  
==== Portconfigs ====
+
systemctl --state=running
Show Portconfics
+
UNIT                        LOAD  ACTIVE SUB    DESCRIPTION
  semanage port -l
+
  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
  
z.B.
 
semanage -l | grep http
 
  
 +
Target sind nun die alten Runlevels
  
ad a Port to http SELinux Roule (-a = add, -m = modifie) :
 
semanage port -a -t http_port_t -p tcp 9192
 
  
 +
Dependensylist eines Services:
 +
[root@tiaki02 ~]# systemctl list-dependencies sshd
 +
sshd.service
 +
● ├─sshd-keygen.service
 +
● ├─system.slice
  
==== Filemanagement ====
 
fcontext
 
  
Zeigt SELinux Parts
+
Definition anzeigen eines Services:
  [root@tiaki02 ~]# ls -lZ
+
  [root@tiaki02 ~]# systemctl cat sshd
  -rw-------. root root system_u:object_r:admin_home_t:s0 anaconda-ks.cfg
+
  # /usr/lib/systemd/system/sshd.service
  -rw-r--r--. root root unconfined_u:object_r:admin_home_t:s0 qq
+
[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 ~]#
 
  [root@tiaki02 ~]#
  
 +
=== alle offenen files lsof ===
 +
lsof | grep etc
 +
oder
 +
lsof /etc/ssh/
  
 +
== Loging ==
  
User    : object  : Type      : Sercurity Level
+
=== Logs allgemein ===
  system_u :object_r :admin_home_t:s0
+
  /var/log/
  
Ändern fcontext to librarry:
+
  /var/log/audit
  semanage fcontext -a -t sshd_key_t /etc/ssh/sshd_conmfig
 
  
ändern mit chcon (nur temporär:
+
  /var/Log/messages alles ausser die definierten logs
change a Type
+
  chcon -t ssh_key_t /etc/sshd/sshd_config
 
  
Reset der chcon
+
journalctl --since 9:05:00 --until 12:00:00
  restorechcon -v /etc/sshd/ssd_config
+
-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
  
semanage fcontext -a -t sshd_key_t /etc/ssh/sshd_conmfig
 
  
 +
=== last ===
 +
Loging History
 +
last
  
==== boolean ====
 
semanage boolean -l |grep httpd
 
  
==== logs ====
 
/var/log/audit/audit.log
 
  
 +
== Networking ==
  
 +
ip addr
 +
ip l Physikalisch Links
 +
ip r route
  
Es kann auch ein einzelner Typ auf permissive gesetzt werden
 
  
  semanage permissive -a ssh_t
+
  /etc/sysconfig/network-scripts/ifcfg-ens192
  
und mit folgendem wird dies aufgelistet:
+
nmcli con - Connections anzeigen, es können mehrere Connections pro IF angelegt werden
  semanage permissive -l
+
  nmcli d - Devices
 +
 +
=== Hostname ===
 +
hostnamectl
  
=== netstat -tulpn ===
+
set-hostnamectl tsetserver2
  
  
 +
=== timedatectl ===
 +
Zeitzonen einstellen
  
=== fail2ban ===
 
Dynamischer FW Blocker für Bruteforce Attacken.
 
  
 +
=== Tools ===
  
=== Kurs ===
+
==== Telnet ====
RedHat Software Collection RHSCL
+
telnet google.ch:80
 +
GET /HTML1.1
  
== Debug ==
+
telnet localhost:22
  
zb:
+
=== netcat ===
  journalctl -u crond -f
+
  nc localhost 22
  
== User ==
+
  nc localhost 1-100
  userdel [USERtoDELETE]
 
useradd [NEWUSER]
 
passwd [NEWUSER]
 
  
=== User abmelden CLI ===
+
MiniChat =)
  who -u
+
  nc -l 4444 auf dem einen Host
that give you the PID
+
auf dem anderen Host
 +
nc IP Port
 +
nc 172.1.1.23 4444
  
Then you can kill the user session.
 
kill "pid"
 
oder
 
sudo pkill -9 -u username
 
  
== SAN/FC/HBA/Disc ==
 
  
=== Display Physical Volume ===
+
=== nmap ===
pvdisplay
+
nmap localhost -
  
  
=== Display Logical Group ===
 
vgdisplay
 
  
 +
=== ethtool ===
 +
ethtool ens192
  
=== Display Logical Volume ===
 
lvdisplay
 
  
  
=== SAN Karte identifizieren ===
+
== Proxy ==
[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]#
 
  
 +
=== 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.
  
=== Check ob die HBA Treiber im Kernel geladen sind ===
+
echo -e "http_proxy=http://192.168.43.100:3128/\nhttps_proxy=https://192.168.43.100:3128/" | sudo tee -a /etc/environment
[root@hszf04 scsi]# lsmod | grep qla2xxx
 
qla2xxx              621980  0
 
scsi_transport_fc      64056  1 qla2xxx
 
[root@hszf04 scsi]#
 
  
 +
http_proxy=http://192.168.43.100:3128/
 +
https_proxy=https://192.168.43.100:3128/
  
=== SAN Port Status ===
+
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.
[root@hszf04 scsi]# cat /sys/class/fc_host/host*/port_state
 
Online
 
Online
 
[root@hszf04 scsi]#
 
  
== Passwörter ==
+
  sudo netplan apply
=== 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
 
  
 +
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.
  
== Bootstik ==
+
wget google.com
 +
--2019-03-23 12:34:05--  http://google.com/
 +
Connecting to 192.168.43.100:3128...
  
=== Windows Bootstik auf Linux erstellen ===
+
sudo apt update
 +
0% [Connecting to 192.168.43.100 (192.168.43.100)] [Connecting to 192.168.43.100 (192.168.43.100)]...
  
* Etcher https://etcher.io/
 
  
* Fork http://www.webupd8.org/2016/06/make-bootable-windows-10-usb-install.html
+
=== 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
  
== SAMBA ==
+
Acquire::http::Proxy "http://192.168.43.100:3128/";
=== Einzelne Hosts berechtigen ohne Useranmeldung ===
+
Acquire::https::Proxy "https://192.168.43.100:3128/";
smb.conf
 
  
#smb.conf is the main Samba configuration file. You find a full commented
+
If your proxy server requires username/password authentication, then the environment variables would set as below;
#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.<br>
+
http_proxy=http://Username:Password@192.168.43.100:3128/
Bei wenigen Shares können die Shareangaben auch gleich direkt in der smb.conf gepflegt werden
+
https_proxy=https://Username:Password@192.168.43.100:3128/
  
/etc/samba/shares/shares.conf
+
For APT;
  
  [test]
+
  Acquire::http::Proxy "http://Username:Password@192.168.43.100:3128/";
comment = Temporary file space
+
  Acquire::https::Proxy "https://Username:Password@192.168.43.100:3128/";
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 ==
+
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;
suse:
+
sudo 'http_proxy=http://192.168.43.100:3128' apt update
* gehe als root ins Verzeichnis */etc/sysconfig/network*
+
or
* kopiere am einfachsten eine bestehene vlan Config cp -p ifcfg-vlan1292 ifcfg-vlan***
+
sudo 'http_proxy=http://Username:Password@192.168.43.100:3128' apt update
* bearbeite sie mit vi ifcfg-vlan***
+
 
* lese die Configs neu ein: rcnetwork restart
+
== Firewall ==
* kontrolliere mit ifconfig das IF....voila
 
  
== Startablauf ==
+
=== Gufw Firewall on Ubuntu ===
=== /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 #
 
  
<br><br><br>
+
To block IP ranges fillout like this:
  
 +
[[Datei:linux_gufw_firewall_iprange01.jpg]][[Datei:linux_gufw_firewall_iprange02.jpg]]
  
=== Ubuntu 18.04/Autostart ===
+
172.16.98.0/24
  
==== für Dektop Programme ====
+
== Security ==
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:
+
=== Security Check ===
 +
für Ubuntu und Debian:
  
[Desktop Entry]
+
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.
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:
+
* Checksecurity --> PM
  
OnlyShowIn=GNOME;Unity; # diese Datei wird nur in GNOME und Unity gestartet
+
=== SELinux / Apparmor ===
# oder alternativ
 
NotShowIn=
 
  
  
 +
User die in SELinux eingebunden sind.
 +
semanage user -l
  
  
 +
Wichtig sind
 +
* fcontext
 +
* boolean
  
 +
==== Portconfigs ====
 +
Show Portconfics
 +
semanage port -l
  
==== Autostart einrichten ====
+
z.B.
 +
semanage -l | grep http
  
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.
+
ad a Port to http SELinux Roule (-a = add, -m = modifie) :
 +
semanage port -a -t http_port_t -p tcp 9192
  
vi /etc/systemd/system/maria-autostart.sh
 
  
#!/bin/sh
+
==== Filemanagement ====
  #
+
fcontext
  # /etc/systemd/system/maria-autostart.sh
+
 
+
Zeigt SELinux Parts
case $1 in
+
  [root@tiaki02 ~]# ls -lZ
  start)
+
  -rw-------. root root system_u:object_r:admin_home_t:s0 anaconda-ks.cfg
    bash /root/firewall.sh
+
-rw-r--r--. root root unconfined_u:object_r:admin_home_t:s0 qq
    su maria -l -c 'bash autostart.sh' &
+
  [root@tiaki02 ~]#
    ;;
 
  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":
+
User    : object  : Type      : Sercurity Level
 +
system_u :object_r :admin_home_t:s0
  
  vi /etc/systemd/system/maria-autostart.service
+
Ändern fcontext to librarry:
 +
  semanage fcontext -a -t sshd_key_t /etc/ssh/sshd_conmfig
  
[Unit]
+
ändern mit chcon (nur temporär:
Description=At system boot start firewall and call autostart.sh of user.
+
change a Type
+
  chcon -t ssh_key_t /etc/sshd/sshd_config
[Service]
+
 
Type=oneshot
+
Reset der chcon
  ExecStart=/etc/systemd/system/maria-autostart.sh start
+
  restorechcon -v /etc/sshd/ssd_config
  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
+
semanage fcontext -a -t sshd_key_t /etc/ssh/sshd_conmfig
  
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 ==
+
==== boolean ====
 +
semanage boolean -l |grep httpd
  
(Zur Vertiefung siehe auch: https://wiki.ubuntuusers.de/Cron/)
+
==== logs ====
 +
/var/log/audit/audit.log
  
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.
+
Es kann auch ein einzelner Typ auf permissive gesetzt werden
  
 +
semanage permissive -a ssh_t
  
 +
und mit folgendem wird dies aufgelistet:
 +
semanage permissive -l
  
<br><br><br>
+
=== netstat ===
 +
Sehen an welchen Ports was hört:
 +
netstat -tulpn
  
== IPMI ==
+
Z.B. sehen welche IPs im augenblick auf eine webseite connected sind:
ipmitool installieren
+
netstat -tn | grep ESTA | grep ":80 "
  
auf ipmi adresse verbinden
+
oder als anfang für eine Statistik:
  ipmitool -I lanplus -H xxx.xxx.xxx.xxx -U admin shell
+
  netstat -tnc | grep ESTA | grep ":80 ">>stats.txt
  
 +
=== fail2ban ===
 +
Dynamischer FW Blocker für Bruteforce Attacken.
  
  
Zovi - Test ob login ohne PW möglich (cipher-suite-0 attack) =)
+
=== Kurs ===
ipmitool -I lanplus -H xxx.xxx.xxx.xxx -P bad_passwd -C0 user list
+
RedHat Software Collection RHSCL
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
 
  
[https://isc.sans.edu/forums/diary/New+Supermicro+IPMIBMC+Vulnerability/18285/ Infos]
+
== Debug ==
  
 +
zb:
 +
journalctl -u crond -f
  
== Allgemein ==
+
== User ==
=== Message Banner Login Text ===
+
userdel [USERtoDELETE]
 +
useradd [NEWUSER]
 +
passwd [NEWUSER]
  
==== Banner für User ====
+
=== User abmelden CLI ===
Für einen speziellen User ein Login Banner machen
+
  who -u
  vi ~/.bashrc
+
that give you the PID
---
 
echo "################################################################################################################################"
 
echo "-------------------- Maybe Networker Servers are in \"Failover mode\", be careful, you're logged in on hbeh05 --------------------"
 
echo "################################################################################################################################"
 
  
==== Login Banner ====
+
Then you can kill the user session.
Welcome Banner für alle
+
kill "pid"
 +
oder
 +
sudo pkill -9 -u username
  
vi /etc/motd
+
== SAN/FC/HBA/Disc ==
  
                                    ###############################
+
=== Display Physical Volume ===
                                    #                            #
+
pvdisplay
                                    #      Welcome on Machine1    #
 
                                    #                            #
 
                                    ###############################
 
  
=== Auslesen CPU ===
 
Usage nach Prozess:
 
top
 
Ussage pro CPU:
 
mpstat -P ALL 2
 
  
 +
=== Display Logical Group ===
 +
vgdisplay
  
=== Auslesen Memory used ===
 
vmstst 3
 
  
 +
=== Display Logical Volume ===
 +
lvdisplay
  
=== Grösse auslesen von Ordner ===
 
du -hs /<pfad>/*
 
  
Zeigt nur diesen Ordner an:
+
=== SAN Karte identifizieren ===
  du -hs /<pfad>/
+
  [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)
"-d 0" zeigt nur ein Level von Ordnern an und rechnet sie zusammen
+
27:00.0 Fibre Channel [0c04]: QLogic Corp. ISP2532-based 8Gb Fibre Channel to PCI Express HBA [1077:2532] (rev 02)
  du -h -d 0 /mnt/nfs_cifs_sql/
+
[root@hszf04 scsi]#
  
BM zeigt Resultat in MB an
 
du -hBM -d 0 /mnt/nfs_cifs_sql/*
 
  
 +
=== 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]#
  
  
<br><br><br>
+
=== SAN Port Status ===
 +
[root@hszf04 scsi]# cat /sys/class/fc_host/host*/port_state
 +
Online
 +
Online
 +
[root@hszf04 scsi]#
  
== Netzwerk zügs ==
+
== Passwörter ==
 
+
=== Reset root PW ===
=== WIFI ===
+
getestet auf RedHat RHEL7
Echtzeit Signalstärke sehen
+
* Reboot the system .
  watch -n1 iwconfig
+
* 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.
=== Bonding ===
+
* You will get the “switch-root” prompt like below.
[http://www.linuxfoundation.org/collaborate/workgroups/networking/bonding Detailierte Doku]
+
* 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
  
==== Bonding Modes ====
 
Descriptions of bonding modes
 
  
'''Mode 0'''
+
== Bootstik ==
  
balance-rr
+
=== Windows Bootstik auf Linux erstellen ===
  
Round-robin policy: Transmit packets in sequential order from the first available slave through the last. This mode provides load balancing and fault tolerance.
+
* Etcher https://etcher.io/
  
'''Mode 1'''
+
* Fork http://www.webupd8.org/2016/06/make-bootable-windows-10-usb-install.html
  
active-backup
+
* Multiboot - Geil - aber ersteuä uf windoof https://pendrivelinux.com/yumi-multiboot-usb-creator/
 +
----
  
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.
+
== SAMBA ==
 +
=== Einzelne Hosts berechtigen ohne Useranmeldung ===
 +
smb.conf
  
'''Mode 2'''
+
#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
balance-xor
+
#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
  
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.
+
In der includeten shares.conf können pro Share verschiedene Einstellungen gemacht werden.<br>
 +
Bei wenigen Shares können die Shareangaben auch gleich direkt in der smb.conf gepflegt werden
  
'''Mode 3'''
+
/etc/samba/shares/shares.conf
  
broadcast
+
[test]
 
+
comment = Temporary file space
Broadcast policy: transmits everything on all slave interfaces. This mode provides fault tolerance.
+
path = /tmp/test
 
+
read only = no
'''Mode 4'''
+
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
  
802.3ad
+
== 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
  
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.
+
== Startablauf ==
 
+
=== /etc/init.d ===
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.
+
* 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 #
  
'''Mode 5'''
+
<br><br><br>
  
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.
+
=== Ubuntu 18.04/Autostart ===
  
Prerequisites:
+
==== für Dektop Programme ====
 +
Für alle Benutzer
  
1.Ethtool support in the base drivers for retrieving the speed of each slave.
+
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:
  
'''Mode 6'''
+
[Desktop Entry]
 +
Type=Application
 +
  Name=Musterprogramm
 +
Exec=Auszuführendes Kommando
  
balance-alb
+
Will man zusätzlich steuern, in welchen Desktop-Umgebungen der Autostart ausgeführt wird, benötigt man eine weitere Zeile wie:
  
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.  
+
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
  
==== Teaming LACP einrichten ====
+
  #!/bin/sh
===== SusE =====
+
  #
  hbzf01:~ # cat /etc/sysconfig/network/ifcfg-bond0
+
  # /etc/systemd/system/maria-autostart.sh
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:~ #
 
 
   
 
   
 +
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:
  
===== RedHat =====
+
chmod u+x /etc/systemd/system/maria-autostart.sh
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.
+
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":
  
Then in the same directory, change all of the '''ifcfg-eno[1-4]''' files to look like this:
+
vi /etc/systemd/system/maria-autostart.service
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.
+
[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
  
This is straight out of the manual.
+
Wenn beide Dateien erstellt sind, muss der neue Service noch aktiviert werden:
  
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.
+
systemctl enable maria-autostart.service
  
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.
+
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"
  
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:
+
== Rechner einmal täglich booten ==
$ 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.
+
(Zur Vertiefung siehe auch: https://wiki.ubuntuusers.de/Cron/)
  
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.
+
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:
<br><br><br>
 
  
==== Bondingstatus der einzelnen IFs sehen ====
+
  0 6 * * * root shutdown -r now
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 ===
+
Die Zahlen geben die Uhrzeit an, hier 6:00 Uhr.
==== 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).
 
  
  
 +
<br><br><br>
  
 +
== 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
  
==== BMON ====
+
[https://isc.sans.edu/forums/diary/New+Supermicro+IPMIBMC+Vulnerability/18285/ Infos]
Kommandozeilen Tool mit Ansicht pro Interface und Historyfunktion
 
  
sudo apt-get install bmon
 
  
 +
== Allgemein ==
 +
=== Message Banner Login Text ===
  
<br><br>
+
==== 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 "################################################################################################################################"
  
=== Status der einzelnen IFs sehen ===
+
==== Login Banner ====
==== eth ====
+
Welcome Banner für alle
ethtool eth4
 
  
 +
vi /etc/motd
  
==== Bonding ====
+
                                    ###############################
bei Suse:<br>
+
                                    #                            #
less /proc/net/bonding/bond1
+
                                    #      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
  
 +
<pre>
 +
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                    |
 +
+---------------------------------------+
  
  
=== Verbundene tcp - udp Sessions auf IPs ikl. Ports anzeigen ===
+
Beispiel:
  netstat -an | grep 192
+
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
  
Hier im Beispiel alle 192.*** er Adressen
+
</pre>
  
=== ARP, Neighbor, Scan und co.===
+
=== Auslesen CPU ===
 +
Usage nach Prozess:
 +
top
 +
Ussage pro CPU:
 +
mpstat -P ALL 2
  
==== kleiner witziger Sniffer ====
 
sudo ngrep -d eth0 -i "irgendöppis(suechwort)"
 
  
oder
+
=== Auslesen Memory used ===
 +
vmstst 3
  
netcat -z -v [Hostname] [Portrange]
 
zB:
 
netcat -z -v sonne33.pipapo.ch 1-1230
 
  
 +
=== 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/
  
==== fing ====
+
BM zeigt Resultat in MB an
You can also install the tool fing and do a network discovery using this tool. It available as a [http://www.overlooksoft.com/download 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.
+
du -hBM -d 0 /mnt/nfs_cifs_sql/*
  
 +
Sortieren nach grösse
 +
du -hs /var/* | sort -h
  
$ 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 |            |
 
...
 
  
 +
<br><br><br>
  
Don't let this tools simplicity fool you though. You can output the contents into csv files as well as html files:
+
== Netzwerk zügs ==
  
  $ sudo fing -n 192.168.1.0/24 -o table,html,blah.html
+
=== WIFI ===
 +
Echtzeit Signalstärke sehen
 +
  watch -n1 iwconfig
  
Then view it:
 
  
$ elinks blah.html
 
  
 +
=== Bonding ===
 +
[http://www.linuxfoundation.org/collaborate/workgroups/networking/bonding Detailierte Doku]
  
To write out the results in CSV format:
+
==== Bonding Modes ====
 +
Descriptions of bonding modes
  
$ sudo fing -o log,text log,csv,my-network-log.csv
+
'''Mode 0'''
 +
 
 +
balance-rr
  
To discover a specific block of IPs you can explicityly tell fing what IP block to scan:
+
Round-robin policy: Transmit packets in sequential order from the first available slave through the last. This mode provides load balancing and fault tolerance.
  
$ sudo fing -n 192.168.1.0/24
+
'''Mode 1'''
  
== Sonstiges ==
+
active-backup
  
=== Version der Distri und Kernelversion anzeigen ===
+
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.
  
hostnamectl
+
'''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.
  
=== Patchscript anstossen ===
+
'''Mode 3'''
/usr/local/scripts/do_youpatch.sh reboot
+
 
oder wenn im gleichen Ordner
+
broadcast
./do_youpatch.sh reboot
 
  
=== du ===
+
Broadcast policy: transmits everything on all slave interfaces. This mode provides fault tolerance.
Diskusage
 
  
==== Grössenangabe von Ordner ====
+
'''Mode 4'''
Zeigt alle Unterordner an
 
du -hs /<pfad>/*
 
  
Beispiel:
+
802.3ad
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
+
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.
du -hs /<pfad>/
 
  
Beispiel:
+
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.
hszf01:/ #
 
du -hs /mnt/nfs_cifs_sql/
 
7.0T  /mnt/nfs_cifs_sql/
 
hszf01:/ #
 
  
 +
'''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:
  
=== df ===
+
1.Ethtool support in the base drivers for retrieving the speed of each slave.
  
df -h
+
'''Mode 6'''
zeigt alle Partitionen und Mounts an
 
  
 +
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.
  
  
=== ps ===
+
==== Teaming LACP einrichten ====
  ps -ef
+
===== 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:~ #
 +
  
zB zeigt alle offenen Telnet sessions:
 
ps -ef|grep telnet
 
  
 +
===== 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}'
  
=== kill ===
+
As above, your local files will differ a bit, because you will need to preserve the existing HWADDR setting.
kill [PID]
 
  
zb:
+
This is straight out of the manual.
kill 42338
 
  
 +
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.
  
=== chkconfig ===
+
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.
chkconfig -A
 
  
== RPM to DEB - alien ==
+
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
um ein rpm Installationspaket in eine deb (Debian) version zu konvertieren bitte folgendes beachten.
+
$ sudo systemctl disable NetworkManager.service
[http://embraceubuntu.com/2005/09/23/installing-using-an-rpm-file/ Anleitung]
+
$ sudo systemctl start network.service
 +
$ sudo systemctl enable network.service
  
Remainder:
+
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.
sudo alien -k name-of-rpm-file.rpm
 
  
 +
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.
 +
<br><br><br>
  
 +
==== 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).
  
  
== 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.<br>
 
Also:
 
  
<code>gksu <programm></code>
 
  
z.B.: Nautilus
 
  
<code>*gksu* nautilus --no-desktop computer:</code>
 
  
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:
 
  
<code>su-to-root -X -c <programm></code>
 
  
z.B.: Nautilus
+
==== BMON ====
 +
Kommandozeilen Tool mit Ansicht pro Interface und Historyfunktion
 +
 
 +
sudo apt-get install bmon
 +
 
 +
 
 +
<br><br>
 +
 
 +
=== Status der einzelnen IFs sehen ===
 +
==== eth ====
 +
ethtool eth4
  
<code>su-to-root -X -c nautilus --no-desktop computer:</code>
 
  
=== Script in Ubuntu mit root Rechten laufen lassen ===
+
==== Bonding ====
>>>Dies ist aus<br>
+
bei Suse:<br>
>>>Sicherheitsgründen so, da es relativ einfach ist über ein setuid-root<br>
+
less /proc/net/bonding/bond1
>>>shellscript zu einer root shell zu kommen.<br>
+
 
>><br>
+
 
>>Das macht Sinn.<br>
+
 
>><br>
+
 
>><br>
+
=== Verbundene tcp - udp Sessions auf IPs ikl. Ports anzeigen ===
>>>Ich verstehe nicht, wieso du dein script nicht mit sudo startest (z.B.<br>
+
netstat -an | grep 192
>>>sudo /root/script). So kannst du das gut testen bis Du das in der<br>
+
 
>>>crontab eingetragen hast.<br>
+
Hier im Beispiel alle 192.*** er Adressen
>><br>
+
 
>>Das kann ich, dann muss ich aber auch alle Befehle innerhalb des Scripts<br>
+
=== ARP, Neighbor, Scan und co.===
>>mit sudo versehen, sonst gibt es das genannte Problem.<br>
+
 
><br>
+
==== kleiner witziger Sniffer ====
><br>
+
sudo ngrep -d eth0 -i "irgendöppis(suechwort)"
> Dann machst du definitiv noch etwas falsch. Ich vermute mal, dass das<br>
+
 
> nichts mit den Rechten zu tun hat, sondern einfach an deinem Skript<br>
+
oder
> liegt. Wenn du das Skript mit sudo startest, dann läuft es mit UID 0<br>
+
 
> (root) und das gilt auch für alle Prozesse, die das Skript startet.<br>
+
netcat -z -v [Hostname] [Portrange]
><br>
+
zB:
><br>
+
netcat -z -v sonne33.pipapo.ch 1-1230
>>Mir ist noch nicht ganz klar, warum die crontab dann später ohne sudo<br>
+
netcat -z sonne33.pipapo.ch 1-1230
>>auskommt, aber ich brav sudo eintippen muss. Bisher bin ich immer davon<br>
+
 
>>ausgegangen "was root gehört, darf alles" und der Inhalt von /bin z.B.<br>
+
==== fing ====
>>gehört ja root.<br>
+
You can also install the tool fing and do a network discovery using this tool. It available as a [http://www.overlooksoft.com/download 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.
><br>
+
 
> Zuerst zu cron: Cron läuft ja bereits als root. Es kann also weitere<br>
+
 
> Prozesse (z.B. die Cronjobs) als root starten. Also hier ist kein<br>
+
$ sudo fing
> Problem.<br>
+
20:59:54 > Discovery profile: Default discovery profile
> Ich glaube dir ist noch nicht ganz klar, wie das sudo/root Konzept von<br>
+
20:59:54 > Discovery class:  data-link (data-link layer)
> Ubuntu aussieht. Der root Account auf einem Ubuntu System existiert<br>
+
20:59:54 > Discovery on:      192.168.1.0/24
> genauso wie auf jedem anderen System auch. Er hat einfach ein<br>
+
> deaktiviertes Passwort. Das hindert aber Daemons (wie cron) nicht daran<br>
+
20:59:55 > Discovery round starting.
> als root zu laufen und sie benötigen dazu auch nicht sudo. Sudo brauchst<br>
+
20:59:55 > Host is up:  192.168.1.20
> du nur, wenn du als Benutzer etwas als mit root-Rechten laufen lassen<br>
+
            HW Address:  00:26:C7:85:A7:20 (Intel)
> willst. Der einzige Unterschied zwischen Ubuntu und einem "normalen"<br>
+
            Hostname:    greeneggs.bubba.net
> Linux Installation ist, dass du nicht also root einloggen kannst und<br>
+
...
> dass du den Befehl su nicht benutzen kannst. Beides kannst du aber auch<br>
+
...
> unter Ubuntu einfach ermöglichen, in dem du "sudo passwd" ausführst und<br>
+
-------------------------------------------------------------------------------
> dem root Account ein Passwort gibst.<br>
+
| State | Host                              | MAC Address      | Last change |
> Das root Konzept von OS X ist im übrigen genau gleich wie jenes von<br>
+
|-----------------------------------------------------------------------------|
> Ubuntu.<br>
+
|  UP  | 192.168.1.1                      | 00:18:51:4X:XX:XX |            |
><br>
+
|  UP  | 192.168.1.2                      | 00:25:22:1X:XX:XX |            |
> Nun noch zum "was root gehört, darf alles": Hier vermischt du die<br>
+
|  UP  | 192.168.1.3                      | 00:19:D1:EX:XX:XX |            |
> Dateisystemrechte einer ausführbaren Datei mit den Rechten eines<br>
+
|  UP  | 192.168.1.4                      | 00:A0:CC:3X:XX:XX |            |
> laufenden Prozesses. Beides hat (abgesehen von setuid) eigentlich nichts<br>
+
...
> miteinander zu tun. Egal wem eine ausführbare Datei gehört, erbt der<br>
+
 
> Prozess, welcher entsteht wenn du sie ausführst immer die Rechte des<br>
+
 
> Prozesses aus welchem er gestartet wurde. Also zum Beispiel die Rechte<br>
+
Don't let this tools simplicity fool you though. You can output the contents into csv files as well as html files:
> der Shell, wenn du einen Befehl auf der Shell eintippst. Das gesetzte<br>
+
 
> setuid Bit ändert dieses verhalten. Dann bekommt der neue Prozess die<br>
+
$ sudo fing -n 192.168.1.0/24 -o table,html,blah.html
> Rechte des Owners der Binärdatei im Dateisystem. Z.B. sudo hat das<br>
+
 
> setuid Bit gesetzt, da es als root laufen muss, um seine Funktion zu<br>
+
Then view it:
> erfüllen.<br>
+
 
><br>
+
$ elinks blah.html
><br>
+
 
>>Liegt des Rätsels Lösung also darin, dass der cronjob mit dem passenden<br>
 
>>setuid-but ausgeführt wird und somit dessen Rechte automatisch auch für<br>
 
>>das aktivierte Script gelten, während das Script alleine diese Rechte<br>
 
>>offenbar gar nicht haben kann?<br>
 
><br>
 
><br>
 
> Nein ein cron job mit setuid bit ist praktisch in jedem fall eine<br>
 
> fehlkonfiguration. Der job erbt die Rechte vom cron daemon, welcher ihn<br>
 
> startet und kann damit also root laufen. Bei Jobs in crontabs von<br>
 
> Benutzern gibt cron seine root Rechte "freiwillig" auf und setzt die<br>
 
> Rechte des Jobs auf die Rechte des Benutzers zu dem der Job gehört. Das<br>
 
> kann cron, weil es als root läuft.<br>
 
><br>
 
> So das wurde ja nun ein richtiger Crashkurs in Unix Prozessrechten.<br>
 
Posted by Gaudenz<br>
 
THX<br>
 
  
== Mount / Disk / Partitionen ==
+
To write out the results in CSV format:
  
=== fstab ===
+
  $ sudo fing -o log,text log,csv,my-network-log.csv
  # NFS
 
#10.1.1.222:/data/col1/backup /media/DD-Backup nfs rw 0 0
 
#10.1.1.222:/data/col1/zovi /media/DD-Zovi nfs rw 0 0
 
#10.1.1.222:/data/col1/VM_storage1 /media/DD-VMstorage nfs rw 0 0
 
#10.1.1.201:/volume1/Backup2 /media/Syn106-Backup2 nfs rw 0 0
 
#  10.1.1.202:/mnt/HD_a2/moviez /media/Moviez-0-C nfs rw 0 0
 
#  10.1.1.200:/volume1/moviez/Moviez /media/Moviez-D-Z nfs rw 0 0
 
#10.1.1.200:/volumeUSB1/usbshare /media/Serien nfs rw 0 0
 
#10.1.1.200:/volumeUSB2/usbshare /media/MusicVideos 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
 
  
 +
To discover a specific block of IPs you can explicityly tell fing what IP block to scan:
  
  //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
+
  $ sudo fing -n 192.168.1.0/24
#//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 ===
+
== Sonstiges ==
  
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.
+
=== Version der Distri und Kernelversion anzeigen ===
  
Dies hat viele Vorteile...
+
hostnamectl
  
* 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.
 
  
  
 +
=== Patchscript anstossen ===
 +
/usr/local/scripts/do_youpatch.sh reboot
 +
oder wenn im gleichen Ordner
 +
./do_youpatch.sh reboot
  
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.
+
=== du ===
Anleitung zusätzliche vmdk Disk einbinden:
+
Diskusage
  
Voraussetzung: VMDK Disk muss im vSphere erstellt und in der VM eingebunden sein.
+
==== Grössenangabe von Ordner ====
 +
Zeigt alle Unterordner an
 +
du -hs /<pfad>/*
  
*    Ordner /data1 erstellen und mit "chmod 777 /data1" auf volle Berechtigungen für alle setzen.
+
Beispiel:
 
+
hszf01:/ # du -hs /mnt/nfs_cifs_sql/*
*   Mit "fdisk -l" die neue Disk scannen und den Pfad auslesen.
+
420G   /mnt/nfs_cifs_sql/c05awg
Z.B.
+
61G    /mnt/nfs_cifs_sql/c05awh
  [root@elastica99 ~]# fdisk -l
+
227G   /mnt/nfs_cifs_sql/c05awv
  Disk /dev/sdb: 107.4 GB, 107374182400 bytes, 209715200 sectors
+
173G    /mnt/nfs_cifs_sql/c05aww
  Units = Sektoren of 1 * 512 = 512 bytes
+
  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>/
  
→ falls nicht gefunden am besten ein Reboot machen und nochmals scannen.
+
Beispiel:
 +
hszf01:/ #
 +
du -hs /mnt/nfs_cifs_sql/
 +
7.0T  /mnt/nfs_cifs_sql/
 +
hszf01:/ #
  
  
*    Partition erstellen:
+
'''Zeige die grösten Files an'''
mit "'''fdisk /dev/sdb'''"<br>
+
du -h | sort -rh | head -20
'''n''' für new<br>
 
'''p''' für Primary<br>
 
'''1''' für erste Partition<br>
 
dann bei "First cylinder..." 2x '''Enter'''<br>
 
'''t''' um die Partition zu selektieren<br>
 
'''8e''' für definition als Linux LVM<br>
 
'''w''' für write.<br>
 
'''fdisk -l''' zum sehen ob die Partition im '''/dev/sdb1''' erstellt wurde
 
  
*    Mit '''mkfs.ext4 /dev/sdb1''' Partition formatieren<br>
+
=== df ===
→ kann je nach Grösse ein Weilchen dauern...wird aber angezeigt wenn fertig.
 
  
*    Mit '''blkid''' UUID der Disk ermitteln:
+
df -h
 +
zeigt alle Partitionen und Mounts an
  
    [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:
+
=== ps ===
'''mkdir /data1/test'''<br>
+
ps -ef
'''ll /data1'''<br>
 
'''rm -R /data1/test'''<br>
 
'''ll /data1'''<br>
 
  
<br><br><br>
+
zB zeigt alle offenen Telnet sessions:
 +
ps -ef|grep telnet
  
=== 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
+
=== kill ===
:* pvcreate /dev/sdb
+
kill [PID]
        [root@wega99 ~]# pvcreate /dev/sdb
 
        Physical volume "/dev/sdb" successfully created.
 
        [root@wega99 ~]#
 
  
:* '''lvmdiskscan -l''' um die erstellung zu überprüfen
+
zb:
 +
  kill 42338
  
        [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
+
=== chkconfig ===
 +
chkconfig -A
 +
 
 +
== RPM to DEB - alien ==
 +
 
 +
um ein rpm Installationspaket in eine deb (Debian) version zu konvertieren bitte folgendes beachten.
 +
[http://embraceubuntu.com/2005/09/23/installing-using-an-rpm-file/ Anleitung]
 +
 
 +
Remainder:
 +
sudo alien -k name-of-rpm-file.rpm
  
:* ... 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:<br>
 
'''lvextend --resizefs -l +100%FREE /dev/mapper/rhel-var'''
 
  
        [root@wega99 ~]# df -h
+
== Root rechte ==
        Dateisystem          Größe Benutzt Verf. Verw% Eingehängt auf
+
=== Verknüpfung zu Programm mit "root" starten ===
        /dev/mapper/rhel-root  8.0G    1.2G  6.9G  15% /
+
* Starter (Verknüpfung) erstellen oder praktischer den Original Starter kopieren
        devtmpfs              3.9G      0  3.9G    0% /dev
+
* in den Eigenschaften des Starters zum Feld "Befehl" navigieren
        tmpfs                  3.9G      0  3.9G    0% /dev/shm
+
* vor dem Original Startbefehl gksu einfügen.<br>
        tmpfs                  3.9G    8.9M  3.9G    1% /run
+
Also:
        tmpfs                  3.9G      0  3.9G    0% /sys/fs/cgroup
+
 
        /dev/sda1              497M    207M  290M  42% /boot
+
<code>gksu <programm></code>
        /dev/mapper/rhel-var  7.0G    471M  6.6G    7% /var
+
 
        /dev/mapper/rhel-home  6.5G    33M  6.5G    1% /home
+
z.B.: Nautilus
        tmpfs                  783M      0  783M    0% /run/user/1003
+
 
        [root@wega99 ~]#
+
<code>*gksu* nautilus --no-desktop computer:</code>
        [root@wega99 ~]#
+
 
        [root@wega99 ~]# lvextend --resizefs -l +100%FREE /dev/mapper/rhel-var
+
oder
          Size of logical volume rhel/var changed from 100.00 GiB (25601 extents) to 107.00 G
+
* Installiere das Paket Menu: *sudo apt-get install menu*
          Logical volume rhel/var successfully resized.
+
* Starter (Verknüpfung) erstellen oder praktischer den Original Starter kopieren
        meta-data=/dev/mapper/rhel-var  isize=256    agcount=4, agsize=458752 blks
+
* in den Eigenschaften des Starters zum Feld "Befehl" navigieren
                =                       sectsz=512  attr=2, projid32bit=1
+
* vor dem Original Startbefehl *su-to-root -X -c* einfügen.
                =                       crc=0        finobt=0 spinodes=0
+
Also:
        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
+
<code>su-to-root -X -c <programm></code>
  
Quellen:<br>
+
z.B.: Nautilus
http://ask.xmodulo.com/add-disks-to-lvm-volume-linux.html<br>
 
https://www.thomas-krenn.com/de/wiki/LVM_vergr%C3%B6%C3%9Fern
 
  
=== iso mounten ===
+
<code>su-to-root -X -c nautilus --no-desktop computer:</code>
  
sudo mount -o loop [Pfad\***.iso] /media/cdrom0
+
=== Script in Ubuntu mit root Rechten laufen lassen ===
 
+
>>>Dies ist aus<br>
z.B.:
+
>>>Sicherheitsgründen so, da es relativ einfach ist über ein setuid-root<br>
sudo mount -o loop ~/Desktop/ubuntu-9.04-alternate-i386.iso /media/cdrom0
+
>>>shellscript zu einer root shell zu kommen.<br>
 
+
>><br>
=== Mount Error ===
+
>>Das macht Sinn.<br>
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.
+
>><br>
 
+
>><br>
    sudo mount -t ntfs-3g -o force /dev/sdb1 /mnt
+
>>>Ich verstehe nicht, wieso du dein script nicht mit sudo startest (z.B.<br>
    sudo umount /mnt]]
+
>>>sudo /root/script). So kannst du das gut testen bis Du das in der<br>
    Dann die Platte mal abstöpseln und wieder anstöpseln - sollte anschliessend automatisch gemounted werden.
+
>>>crontab eingetragen hast.<br>
 
+
>><br>
Try it
+
>>Das kann ich, dann muss ich aber auch alle Befehle innerhalb des Scripts<br>
 
+
>>mit sudo versehen, sonst gibt es das genannte Problem.<br>
 
+
><br>
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.  
+
><br>
 
+
> Dann machst du definitiv noch etwas falsch. Ich vermute mal, dass das<br>
 
+
> nichts mit den Rechten zu tun hat, sondern einfach an deinem Skript<br>
=== Partitionen beim Start mounten ===
+
> liegt. Wenn du das Skript mit sudo startest, dann läuft es mit UID 0<br>
 
+
> (root) und das gilt auch für alle Prozesse, die das Skript startet.<br>
als root in der Datei /etc/fstab folgendes eintragen:
+
><br>
/dev/[partition] /media/[mountpoint] [filesystem] defaults 0 0
+
><br>
oder besser via UUID
+
>>Mir ist noch nicht ganz klar, warum die crontab dann später ohne sudo<br>
UUID=[Partitions_UUID] /media/[mountpoint] [filesystem] defaults 0 0
+
>>auskommt, aber ich brav sudo eintippen muss. Bisher bin ich immer davon<br>
um die UUID rauszufinden:  
+
>>ausgegangen "was root gehört, darf alles" und der Inhalt von /bin z.B.<br>
sudo blkid
+
>>gehört ja root.<br>
 
+
><br>
 
+
> Zuerst zu cron: Cron läuft ja bereits als root. Es kann also weitere<br>
z.B.:
+
> Prozesse (z.B. die Cronjobs) als root starten. Also hier ist kein<br>
/dev/sdc1 /media/VMware ntfs defaults 0 0
+
> Problem.<br>
oder via UUID:
+
> Ich glaube dir ist noch nicht ganz klar, wie das sudo/root Konzept von<br>
UUID=7f95b1aa-6b5a-497b-be18-86e36697849c /media/BackUp01_1TB_WD ext3 defaults 0 0
+
> Ubuntu aussieht. Der root Account auf einem Ubuntu System existiert<br>
 
+
> genauso wie auf jedem anderen System auch. Er hat einfach ein<br>
 
+
> deaktiviertes Passwort. Das hindert aber Daemons (wie cron) nicht daran<br>
 
+
> als root zu laufen und sie benötigen dazu auch nicht sudo. Sudo brauchst<br>
 
+
> du nur, wenn du als Benutzer etwas als mit root-Rechten laufen lassen<br>
Netzwerkshares beim Starten mounten
+
> willst. Der einzige Unterschied zwischen Ubuntu und einem "normalen"<br>
 
+
> Linux Installation ist, dass du nicht also root einloggen kannst und<br>
    samba installieren: sudo apt-get install cifs-utils
+
> dass du den Befehl su nicht benutzen kannst. Beides kannst du aber auch<br>
        falls nicht funzt sudo apt-get install smbfs (ältere Mounttools)
+
> unter Ubuntu einfach ermöglichen, in dem du "sudo passwd" ausführst und<br>
    Die Datei in /etc/fstab bearbeiten
+
> dem root Account ein Passwort gibst.<br>
 
+
> Das root Konzept von OS X ist im übrigen genau gleich wie jenes von<br>
=== CIFS ===
+
> Ubuntu.<br>
 
+
><br>
http://ubuntuforums.org/showthread.php?t=288534
+
> Nun noch zum "was root gehört, darf alles": Hier vermischt du die<br>
 
+
> Dateisystemrechte einer ausführbaren Datei mit den Rechten eines<br>
//netbiosname/sharename    /media/sharename        cifs    credentials=/root/.smbcredentials,iocharset=utf8,nounix,file_mode=0777,vers=2.1,dir_mode=0777,uid=1000 0 0
+
> laufenden Prozesses. Beides hat (abgesehen von setuid) eigentlich nichts<br>
 
+
> miteinander zu tun. Egal wem eine ausführbare Datei gehört, erbt der<br>
z.b.:
+
> Prozess, welcher entsteht wenn du sie ausführst immer die Rechte des<br>
 
+
> Prozesses aus welchem er gestartet wurde. Also zum Beispiel die Rechte<br>
//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
+
> der Shell, wenn du einen Befehl auf der Shell eintippst. Das gesetzte<br>
//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
+
> setuid Bit ändert dieses verhalten. Dann bekommt der neue Prozess die<br>
 +
> Rechte des Owners der Binärdatei im Dateisystem. Z.B. sudo hat das<br>
 +
> setuid Bit gesetzt, da es als root laufen muss, um seine Funktion zu<br>
 +
> erfüllen.<br>
 +
><br>
 +
><br>
 +
>>Liegt des Rätsels Lösung also darin, dass der cronjob mit dem passenden<br>
 +
>>setuid-but ausgeführt wird und somit dessen Rechte automatisch auch für<br>
 +
>>das aktivierte Script gelten, während das Script alleine diese Rechte<br>
 +
>>offenbar gar nicht haben kann?<br>
 +
><br>
 +
><br>
 +
> Nein ein cron job mit setuid bit ist praktisch in jedem fall eine<br>
 +
> fehlkonfiguration. Der job erbt die Rechte vom cron daemon, welcher ihn<br>
 +
> startet und kann damit also root laufen. Bei Jobs in crontabs von<br>
 +
> Benutzern gibt cron seine root Rechte "freiwillig" auf und setzt die<br>
 +
> Rechte des Jobs auf die Rechte des Benutzers zu dem der Job gehört. Das<br>
 +
> kann cron, weil es als root läuft.<br>
 +
><br>
 +
> So das wurde ja nun ein richtiger Crashkurs in Unix Prozessrechten.<br>
 +
Posted by Gaudenz<br>
 +
THX<br>
  
im Root ordner folgende Datei mit Inhalt erstellen:<br>
+
== Mount / Disk / Partitionen ==
.smbcredentials<br>
 
username=Test<br>
 
password=Test<br>
 
  
in /media einen Ordner gem. fstab erstellen und mit drwxrwxrwx (40777) berechtigen
+
=== SMART Checks ===
  
voila =)
+
Tools zum überwachen von SMART fähigen HDDs und SSDs
  
=== NFS ===
+
Guter Beschrieb: https://www.howtoforge.com/tutorial/monitor-harddisk-with-smartmon-on-ubuntu/
  
    nfs-common installieren
 
    Dann Link in fs.tab eintragen
 
  
z.B.:
+
CLI:
  192.168.6.13:/home /media/server nfs rw 0 0
+
  sudo apt-get install smartmontools
 +
 +
GUI:
 +
sudo apt-get install gsmartcontrol
  
==== 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
+
=== fstab ===
  mount -t nfs -o hard,intr,nfsvers=3,tcp,rsize=1048600,wsize=1048600,bg datadomain:/data/col1/OracleBackup /OracleBackup
+
# NFS
Link zum Blog [http://www.robsteele.co/best-practices-nfs-mount-for-data-domain/ robsteele.co]
+
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
  
=== fstab ohne reboot neu einlesen ===
+
=== Disk ===
  
mount -a
+
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:
  
==== iPot, iPhone, iPtouch in Ordner mounten ====
+
Voraussetzung: VMDK Disk muss im vSphere erstellt und in der VM eingebunden sein.
  
(zb. für ältere Programme wie GTKpod, Hipo, Ipod Photo uploader, ...usw.)
+
*    Ordner /data1 erstellen und mit "chmod 777 /data1" auf volle Berechtigungen für alle setzen.
siehe hier
 
Mounten:
 
  
  ifuse /mnt/ipod
+
*    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
  
Unmounten:
+
→ falls nicht gefunden am besten ein Reboot machen und nochmals scannen.
  
fusermount -u /mnt/ipod
 
  
 +
*    Partition erstellen:
 +
mit "'''fdisk /dev/sdb'''"<br>
 +
'''n''' für new<br>
 +
'''p''' für Primary<br>
 +
'''1''' für erste Partition<br>
 +
dann bei "First cylinder..." 2x '''Enter'''<br>
 +
'''t''' um die Partition zu selektieren<br>
 +
'''8e''' für definition als Linux LVM<br>
 +
'''w''' für write.<br>
 +
'''fdisk -l''' zum sehen ob die Partition im '''/dev/sdb1''' erstellt wurde
  
 +
*    Mit '''mkfs.ext4 /dev/sdb1''' Partition formatieren<br>
 +
→ kann je nach Grösse ein Weilchen dauern...wird aber angezeigt wenn fertig.
  
 +
*    Mit '''blkid''' UUID der Disk ermitteln:
  
==== Ubuntu 11.10 & iPhone ab iOS 5.0.1 ====
+
    [root@elastica99 ~]# blkid
 
+
    /dev/mapper/rhel-var: UUID="fd03042e-2cea-4ece-aef0-863f43d58101" TYPE="xfs"
Das iPhone ist eingesteckt und die Fehlermeldung erscheint
+
    /dev/sda2: UUID="dXjhsD-Odzq-PpZe-tSvL-LTzJ-TRtc-POBEKD" TYPE="LVM2_member"
In Terminal eingeben:  
+
    /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"
  
  sudo apt-get install libimobiledevice-utils
+
*    Nun im fstab folgenden Eintrag machen (UUID natürlich noch anpassen):
 +
  UUID=2fa34ca4-1e6c-4829-acc9-6f556f49628a /data1        ext4    acl,user_xattr 1 0
  
iPhone Bilderschirm entsperren (wichtig!)
+
*    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 ~]#
  
In Terminal eingeben:  
+
*    RW- Test:
 +
'''mkdir /data1/test'''<br>
 +
'''ll /data1'''<br>
 +
'''rm -R /data1/test'''<br>
 +
'''ll /data1'''<br>
  
idevicepair unpair && idevicepair pair
+
<br><br><br>
  
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.
+
=== VM Disk / Volume vergrössern erweitern ===
 +
Ubuntu
  
=== Mount - GUI Tools ===
+
Ausser die Root ( / ) Partition können die gemounteten ohne Reboot vergrössert werden.
  
ubuntu mountmanager: für ubuntu itrepid 9.04 gibt es eine neuere Version als die Repository Version
+
VM Disk vergrössern im vSphere
http://forum.ubuntuusers.de/post/2173052/
 
  
 +
sudo su -
 +
echo 1 > /sys/block/sdb/device/rescan
  
pyNeighborhood<br>
+
natürlich noch die richtige Disk wählen (sda, sdb, sdc,...)
ist im Repository
 
  
Ist für cifs und smb sehr geeignet
+
oder
  
== Daten kopieren/ verschieben ==
+
sudo apt-get install scsitools -y
=== wget ===
+
  sudo rescan-scsi-bus --forcerescan
  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.
+
gpart öffnen und folgendes machen:
 +
[[Datei:image2021-7-19_10-12-3.png]]
 +
* 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
  
=== scp ===
 
  
scp von nach
+
Kontrolle z.B. mit df -h
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:
+
=== LVM Disk / Volume vergrössern ===
dd if=/dev/hda of=/dev/hdc
+
* 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
 +
        ...
  
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
 
 
== Netzwerkkonfiguration ==
 
Sehr gutes Doku:
 
  
Howto:  
+
* Erstelle Physical Volumes auf den neuen Disks
[http://www.cyberciti.biz/tips/howto-ubuntu-linux-convert-dhcp-network-configuration-to-static-ip-configuration.html Ubuntu Linux convert DHCP network configuration to static IP configuration]
+
:* pvcreate /dev/sdb
 +
        [root@wega99 ~]# pvcreate /dev/sdb
 +
        Physical volume "/dev/sdb" successfully created.
 +
        [root@wega99 ~]#
  
== DVD Codecs und co. ==
+
:* '''lvmdiskscan -l'''  um die erstellung zu überprüfen
[http://ubuntuguide.org/wiki/Ubuntu_Saucy_Audio_Video_Conversion#DVD_Playback_Capability DVD_Playback_Capability]]
 
  
= Software =
+
        [root@wega99 ~]# lvmdiskscan -l
== Webmin ==
+
        WARNING: only considering LVM devices
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.
+
        /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 ~]#
  
Dazu lädt man sich ab der Website das richtige Paket herunter. Anschliessend wird ein Installationsversuch gestartet, der scheitern wird:
+
* Vergrößern des LV
  
<code>
+
:* ... auf die maximale Größe
sudo dpkg -i <paketname>.deb
+
Um den sämtlichen nicht zugeordneten Speicherplatz für das logical Volume zu verwenden, ist folgendes Kommando erforderlich:
</code>
 
  
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:
+
        lvextend -l 100%FREE /dev/mapper/rhel-var
  
<code>sudo apt-get install -f</code>
+
:* ... auf **GB
  
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:
+
        lvextend -L 10G /dev/mapper/rhel-var
  
https://IP_oder_Adresse_des_Servers:10000
+
* Um den zusätzlichen Speicherplatz auch nutzen zu können, muss abschließend noch das Dateisystem vergrößert werden
 +
Dies geschieht mit:<br>
 +
'''lvextend --resizefs -l +100%FREE /dev/mapper/rhel-var'''
  
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.
+
        [root@wega99 ~]# df -h
 
+
        Dateisystem          Größe Benutzt Verf. Verw% Eingehängt auf
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!
+
        /dev/mapper/rhel-root  8.0G    1.2G  6.9G  15% /
 
+
        devtmpfs              3.9G      0  3.9G    0% /dev
Text ursprünglich von ubuntublog.ch
+
        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
=== neu ab 11.10 im terminal ===
+
        /dev/mapper/rhel-var  7.0G    471M  6.6G    7% /var
Install webmin on ubuntu 11.04 (Natty) server
+
        /dev/mapper/rhel-home  6.5G    33M  6.5G    1% /home
 
+
        tmpfs                  783M      0  783M    0% /run/user/1003
Edit /etc/apt/sources.list file
+
        [root@wega99 ~]#
 
+
        [root@wega99 ~]#
<code>   sudo vi /etc/apt/sources.list</code>
+
        [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
Add the following lines
+
          Logical volume rhel/var successfully resized.
 
+
        meta-data=/dev/mapper/rhel-var  isize=256    agcount=4, agsize=458752 blks
<code>
+
                =                      sectsz=512  attr=2, projid32bit=1
deb http://download.webmin.com/download/repository sarge contrib
+
                =                      crc=0        finobt=0 spinodes=0
deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib
+
        data    =                      bsize=4096  blocks=1835008, imaxpct=25
</code>
+
                =                      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 ~]#
  
Save and exit the file
+
* Voila
 +
 
 +
Quellen:<br>
 +
http://ask.xmodulo.com/add-disks-to-lvm-volume-linux.html<br>
 +
https://www.thomas-krenn.com/de/wiki/LVM_vergr%C3%B6%C3%9Fern
  
Now you need to import GPG key
+
=== SWAP Vergrössern in RHEL8 ===
  
<code>
+
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
wget http://www.webmin.com/jcameron-key.asc
+
oder https://www.onesystems.ch/blog/lvm-festplatte-vergroessern-ohne-neue-partition/
  
sudo apt-key add jcameron-key.asc
+
==== Vergrössern der VM Disk ====
</code>
 
  
Update the source list
+
Procedure 15.1. Extending Swap on an LVM2 Logical Volume
  
<code>
+
Disable swapping for the associated logical volume:
sudo apt-get update
+
# swapoff -v /dev/dm-1
</code>
 
  
Install webmin
+
Resize the Physical Volume (Falls dies nicht funktioniert mit dem pvresize, mit ubuntu CD starten und LVM aufziehen)
 +
# pvresize /dev/sda2
  
<code>
+
Resize the LVM2 logical volume by 2 GB:
sudo apt-get install webmin
+
# lvresize /dev/rhel/swap -l +100%FREE
</code>
+
 
 +
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
 +
             
  
Now you need to access webmin using http://serverip:10000/ once it opens you should see similar to the following screen
+
Enable the extended logical volume:
  
== Probleme mit VMWare Server 2.0.* und VMWare Konsole via Firefox ==
+
# swapon -v /dev/mapper/rhel-swap
Das Plugin lässt sich doch auch ohne den Firefox starten:
+
             
  
# Man suche vmware-vmrc im Directory .mozilla
+
To test if the swap logical volume was successfully extended and activated, inspect active swap space:
# Man passe ggf. Rechte an und / oder starte mit bash, also bash vmrare-vmrc
 
  
Syntax:
+
$ cat /proc/swaps
 +
$ free -h
  
<code>
+
=== SWAP Vergrössern in RHEL9 ===
vmware-vmrc -h <hostname:port> -u <username> -p <password>
 
</code>
 
  
Beispiel:
+
Vergrössern der VM Disk in vSphere
  
<code>
+
Disable swapping for the associated logical volume:
bash vmware-vmrc -h localhost:8333 -u driver -p geheim
 
</code>
 
  
oder
+
# swapoff -v /dev/sda4
  
man lege einen Starter an und gebe dies ein(Pfad anpassen):
+
Resize the Physical Volume. Start server with ubuntu CD and resize volume. Reboot
  
<code>
+
Format the new swap space:
/home/driver/.mozilla/firefox/fbxco40n.default/extensions/VMwareVMRC@vmware.com/plugins/vmware-vmrc -h localhost:8333 -u driver -p geheim
 
</code>
 
  
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...
+
  # 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:
  
== SAMBA  ==
+
  $ cat /proc/swaps
=== Einzelne Hosts berechtigen ohne Useranmeldung ===
+
  $ free -h
smb.conf
+
 
#smb.conf is the main Samba configuration file. You find a full commented
+
=== iso mounten ===
  #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
 
  
 +
sudo mount -o loop [Pfad\***.iso] /media/cdrom0
  
In der includeten shares.conf können pro Share verschiedene Einstellungen gemacht werden.<br />
+
z.B.:
Bei wenigen Shares können die Shareangaben auch gleich direkt in der smb.conf gepflegt werden
+
sudo mount -o loop ~/Desktop/ubuntu-9.04-alternate-i386.iso /media/cdrom0
  
/etc/samba/shares/shares.conf
+
=== Mount Error ===
[test]
+
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.
  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
 
  
 +
    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
  
  
== MAC Adressen an ein IF Name binden ==
+
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.  
SUSE
 
vi /etc/udev/rules.d/70-persistent-net.rules
 
  
  
 +
=== Partitionen beim Start mounten ===
  
== Cron ==
+
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
  
=== Cronjob manuell starten ===
 
sh /etc/cron.daily/cronjob
 
  
 +
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
  
=== 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:
+
Netzwerkshares beim Starten mounten
  
@reboot /path/to/script.sh
+
    samba installieren: sudo apt-get install cifs-utils
 +
        falls nicht funzt sudo apt-get install smbfs (ältere Mounttools)
 +
    Die Datei in /etc/fstab bearbeiten
  
If you need to run it as root, don't use ''@reboot sudo /path/to/script.sh'';
+
=== CIFS ===
use ''sudo crontab -eu root'' to edit root's crontab.
 
  
 +
http://ubuntuforums.org/showthread.php?t=288534
  
=== Cron Jobs finden auch wenn nur von User ===
+
//netbiosname/sharename    /media/sharename        cifs    credentials=/root/.smbcredentials,iocharset=utf8,nounix,file_mode=0777,vers=2.1,dir_mode=0777,uid=1000 0 0
ll /var/sppl/cron/
 
  
== Bootloader / Grub ==
+
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
  
=== Loginscreen resolution vergrössern ===
+
im Root ordner folgende Datei mit Inhalt erstellen:<br>
 +
.smbcredentials<br>
 +
username=Test<br>
 +
password=Test<br>
  
sudo nano /etc/default/grub
+
in /media einen Ordner gem. fstab erstellen und mit drwxrwxrwx (40777) berechtigen
  
Use the down arrow or Page Down until you see the line that looks like this:
+
voila =)
  
#GRUB_GFXMODE=640x480
+
=== NFS ===
  
Below that line, enter the following, substituting the 1920x1080 for a supported resolution:
+
    nfs-common installieren
 +
    Dann Link in fs.tab eintragen
  
GRUB_GFXMODE=1920x1080
+
z.B.:
  GRUB_GFXPAYLOAD_LINUX=keep
+
  192.168.6.13:/home /media/server nfs rw 0 0
  
To save your changes, hit Ctrl+o, with "o" as in Ohio, not zero. To exit nano, hit Ctrl+x. Now, update grub:
+
==== DataDomain NFS Anbindungsparameter ====
 +
ddname.test.ch:/data/col1/mtree1 /mnt/nfs_mountfolder nfs rw,hard,rsize=32768,wsize=32768,nolock 0 0
  
  sudo update-grub
+
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 [http://www.robsteele.co/best-practices-nfs-mount-for-data-domain/ robsteele.co]
  
 +
=== fstab ohne reboot neu einlesen ===
  
 +
mount -a
  
<br><br><br><br>
 
  
  
  
== Conky Systemmonitor ==
 
  
[https://github.com/brndnmtthws/conky Conky] ist ein vielseitiger Systemmonitor für den Desktop.
 
  
[[Datei:image2020-1-14_16-37-31.png]]
+
==== iPot, iPhone, iPtouch in Ordner mounten ====
  
Config File /etc/conky/conky.conf
+
(zb. für ältere Programme wie GTKpod, Hipo, Ipod Photo uploader, ...usw.)
 +
siehe hier
 +
Mounten:
  
 +
ifuse /mnt/ipod
  
-- vim: ts=4 sw=4 noet ai cindent syntax=lua
+
Unmounten:
  --[[
+
 
Conky, a system monitor,
+
  fusermount -u /mnt/ipod
+
 
sed on torsmo
+
 
 
+
 
Any original torsmo code is licensed under the BSD license
+
 
 
+
==== Ubuntu 11.10 & iPhone ab iOS 5.0.1 ====
All code written since the fork of torsmo is licensed under the GPL
+
 
 
+
Das iPhone ist eingesteckt und die Fehlermeldung erscheint
  Please see COPYING for details
+
In Terminal eingeben:
 
+
 
Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen
+
  sudo apt-get install libimobiledevice-utils
Copyright (c) 2005-2012 Brenden Matthews, Philip Kovacs, et. al. (see AUTHORS)
+
 
All rights reserved.
+
iPhone Bilderschirm entsperren (wichtig!)
 
+
 
  This program is free software: you can redistribute it and/or modify
+
In Terminal eingeben:
it under the terms of the GNU General Public License as published by
+
 
the Free Software Foundation, either version 3 of the License, or
+
  idevicepair unpair && idevicepair pair
(at your option) any later version.
+
 
 
+
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.
This program is distributed in the hope that it will be useful,
+
 
but WITHOUT ANY WARRANTY; without even the implied warranty of
+
=== Mount - GUI Tools ===
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+
 
GNU General Public License for more details.
+
ubuntu mountmanager: für ubuntu itrepid 9.04 gibt es eine neuere Version als die Repository Version
  You should have received a copy of the GNU General Public License
+
  http://forum.ubuntuusers.de/post/2173052/
along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
 
]]
+
 
 
+
pyNeighborhood<br>
conky.config = {
+
ist im Repository
  alignment = 'top_right',
+
 
  background = false,
+
Ist für cifs und smb sehr geeignet
  border_width = 1,
+
 
  cpu_avg_samples = 2,
+
<br><br><br>
  default_color = 'white',
+
== Daten kopieren/ verschieben ==
  default_outline_color = 'white',
+
=== wget ===
  default_shade_color = 'white',
+
wget -c --limit-rate=200k <URL http, https oder ftp>
  draw_borders = false,
+
 
  draw_graph_borders = true,
+
kann mit Ctl+c abgebrochen werden und je nach Hostserver wieder am angefangenen Download weiter laden.
  draw_outline = false,
+
 
  draw_shades = false,
+
 
  use_xft = true,
+
=== scp ===
  font = 'DejaVu Sans Mono:size=12',
+
 
  gap_x = 5,
+
scp von nach
  gap_y = 60,
+
scp [Host]:/[Pfaad] []
  minimum_height = 5,
+
Beispiel
  minimum_width = 5,
+
scp sysadmin@hddeh4:/ddvar/ddfs.core.16176.1478155960.gz /tmp/hddeh4/
  net_avg_samples = 2,
+
<br><br><br>
  no_buffers = false,
+
=== Disk / Partition Copy ===
  out_to_console = false,
+
 
  out_to_stderr = false,
+
mit dd (dump device) kann eine Festplatte blockweise auf eine andere geschrieben werden.
  extra_newline = false,
+
 
  own_window = true,
+
Beispiel:
  own_window_class = 'Conky',
+
dd if=/dev/hda of=/dev/hdc
  own_window_type = 'desktop',
+
 
  stippled_borders = 0,
+
 
  update_interval = 1.0,
+
Beispiel:
  uppercase = false,
+
* Starte die VM mit dem Ubuntu Live Image
  use_spacer = 'none',
+
* Mit dem gParted die Disks und Partitionen ansehen und die Devicenames notieren (z.B. Orig /dev/sda2 - Ziel /dev/sdb1)
  show_graph_scale = false,
+
* mit sudo dd in=/dev/sda2 of=/dev/sdb1 die Partition auf die zweite Platte (/dev/sdb) kopieren
  show_graph_range = false,
+
* mit Gparted die Zielpartition auf die ganze grösse aufblasen: → menü → Partition → Check
  own_window_argb_visual = true,
+
* Falls nötig:
  own_window_argb_value = 0,
+
**      die kopierte Partition hat natürlich die selbe UUID. Also muss evt noch die UUID geändert werden und im fstab eingepflegt werden.
  double_buffer = true,
+
**      UUID wechseln: gPardet → Menü → Partition → Unmount → Menü → Partition → New UUID
+
**      Neue UUID in /etc/fstab eintragen
}
+
<br>
 
+
<br>
conky.text = [[
+
<br>
${color white} ${alignc} ${font Monospace:size=20} $nodename $font
+
 
${alignc} ${execi 999999 lsb_release -ds}
+
== Diskspace full ==
${color white} ${alignc} ${font Monospace:size=7} $sysname $kernel on $machine $font
+
Kein Platz mehr?
  $hr
+
 
  ${color grey}Logged-In Users:$color ($user_number)  
+
=== Alte Snap Pakete löschen ===
  ${user_names}
+
 
   
+
Unter Ubuntu alte Snap-Pakete löschen
${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}
+
Ü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!
$hr
+
 
${color grey}Uptime:$color $uptime
+
Sie erkennen die alten Pakete am Status disabled.
${color grey}RAM Usage:$color $mem/$memmax - $memperc% ${membar 4}
+
<pre>
${color grey}Swap Usage:$color $swap/$swapmax - $swapperc% ${swapbar 4}
+
snap list --all
${color grey}CPU Usage:$color $cpu% ${cpubar 4}
+
Name                  Version        Rev  Tracking Publisher    Notes
${color grey}CPU Frequency (in GHz):$color $freq_g
+
atom                  1.31.0          199   stable    snapcrafters disabled,classic
${color grey}Processes:$color $processes  ${color grey}Running:$color $running_processes
+
atom                  1.33.1          209  stable    snapcrafters classic
$hr
+
atom                  1.31.2          202  stable    snapcrafters disabled,classic
  ${color grey}File systems:
+
core                  16-2.36.3      6130 stable    canonical✓    core
   / $color${fs_used /}/${fs_size /} ${fs_bar 6 /}
+
core                  16-2.35.2      5548 stable    canonical✓    core,disabled
  $hr
+
core                  16-2.35        5328 stable    canonical✓    core,disabled
  ${color grey}Networking:
+
core18                18             536   stable    canonical✓    base
  ${color grey}IP: $color ${addr ens192}
+
core18                0.1             19    stable    canonical✓    base,disabled
  Down:$color ${downspeedf ens192} k/s ${offset 40}${color grey}Up:$color ${upspeedf ens192} k/s${color grey}
+
gimp                  2.10.6          47    stable    snapcrafters disabled
  ${downspeedgraph ens192 32,120 efefef 171717 100} ${offset 40} ${upspeedgraph ens192 32,120 efefef 171717 100}
+
gimp                  2.10.0          40    stable    snapcrafters  disabled
  $hr
+
gimp                  2.10.8          94    stable    snapcrafters  -
${color grey}Name             PID   CPU%  MEM%
+
gnome-3-26-1604      3.26.0          74    stable/… canonical✓    -
${color lightgrey} ${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}
+
gnome-3-26-1604      3.26.0          70    stable/…  canonical✓    disabled
  ${color lightgrey} ${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}
+
gnome-3-26-1604      3.26.0          64    stable/…  canonical✓    disabled
  ${color lightgrey} ${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}
+
gnome-calculator      3.30.1          260  stable/… canonical✓    -
  ${color lightgrey} ${top name 4} ${top pid 4} ${top cpu 4} ${top mem 4}
+
gnome-calculator      3.30.0          222  stable/… canonical✓    disabled
  ${hr 2}
+
gnome-calculator      3.30.0          238  stable/… canonical✓    disabled
  ${color grey}ESTABLISHED Connections
+
gnome-characters      3.29.91        124  stable/… canonical✓   disabled
  ${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}
+
gnome-characters      3.28.2          117  stable/…  canonical✓   disabled
   
+
gnome-characters      3.30.0          139  stable/… canonical✓    -
  ${color slate grey}${font Ubuntu Mono:size=9}Process        Remote IP           L-Port    R-Port
+
gnome-logs            3.28.2          40    stable/… canonical✓    disabled
  ${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)}'}
+
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
 +
</pre>
 +
 
 +
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:
 +
<pre>
 +
snap list --all | awk '/disabled/{print $1, $3}' |
 +
    while read snapname revision; do
 +
        snap remove "$snapname" --revision="$revision"
 +
    done
 +
</pre>
 +
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 …
 +
 
 +
<br><br><br><br>
 +
=== 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/*'
 +
 
 +
 
 +
<br><br><br><br>
 +
 
 +
=== 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.
  
Autostart einrichten:
+
==== 2 Shrink/Reduce the folder size instantly/immediately ====
  
* Öffne das Programm "Startup Applications"
+
e.g. Delete old log files form /var/log/journal folder, reduce the folder size to 500MB or age max 1 month
* Add
+
 
* [[Datei:image2020-1-14_16-39-35.png]]
+
sudo journalctl --vacuum-time=1m
* Save
+
oder
* Close
+
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
 +
 
 +
 
 +
 
 +
<br><br><br><br>
 +
 
 +
== 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
  
oder für alle Benutzer
 
  
/etc/xdg/autostart/ mit Root-Rechten eine .desktop-Datei für das zu startende Programm anlegen.
+
* -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
  
[Desktop Entry]
+
== Netzwerkkonfiguration ==
Type=Application
+
Sehr gutes Doku:
Name=Conky
 
Exec=conky
 
  
 +
Howto:
 +
[http://www.cyberciti.biz/tips/howto-ubuntu-linux-convert-dhcp-network-configuration-to-static-ip-configuration.html Ubuntu Linux convert DHCP network configuration to static IP configuration]
  
<br><br><br><br>
+
== DVD Codecs und co. ==
 +
[http://ubuntuguide.org/wiki/Ubuntu_Saucy_Audio_Video_Conversion#DVD_Playback_Capability DVD_Playback_Capability]]
 +
 
 +
= 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:
 +
 
 +
<code>
 +
sudo dpkg -i <paketname>.deb
 +
</code>
 +
 
 +
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:
 +
 
 +
<code>sudo apt-get install -f</code>
 +
 
 +
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
 +
 
 +
<code>    sudo vi /etc/apt/sources.list</code>
 +
 
 +
Add the following lines
 +
 
 +
<code>
 +
deb http://download.webmin.com/download/repository sarge contrib
 +
deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib
 +
</code>
 +
 
 +
Save and exit the file
 +
 
 +
Now you need to import GPG key
 +
 
 +
<code>
 +
wget http://www.webmin.com/jcameron-key.asc
 +
 
 +
sudo apt-key add jcameron-key.asc
 +
</code>
 +
 
 +
Update the source list
 +
 
 +
<code>
 +
sudo apt-get update
 +
</code>
 +
 
 +
Install webmin
 +
 
 +
<code>
 +
sudo apt-get install webmin
 +
</code>
 +
 
 +
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:
 +
 
 +
<code>
 +
vmware-vmrc -h <hostname:port> -u <username> -p <password>
 +
</code>
 +
 
 +
Beispiel:
 +
 
 +
<code>
 +
bash vmware-vmrc -h localhost:8333 -u driver -p geheim
 +
</code>
 +
 
 +
oder
 +
 
 +
man lege einen Starter an und gebe dies ein(Pfad anpassen):
 +
 
 +
<code>
 +
/home/driver/.mozilla/firefox/fbxco40n.default/extensions/VMwareVMRC@vmware.com/plugins/vmware-vmrc -h localhost:8333 -u driver -p geheim
 +
</code>
 +
 
 +
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.<br />
 +
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:
 +
<pre>
 +
[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
 +
 
 +
 
 +
</pre>
 +
 
 +
=== ===
 +
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
 +
<br><br><br><br><br><br><br>
 +
 
 +
== 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
 +
 
 +
 
 +
 
 +
<br><br><br><br>
 +
 
 +
 
 +
 
 +
== monitorix ==
 +
 
 +
sudo apt install monitorix
 +
 
 +
add a Firewall rule on port tcp/8080
 +
 
 +
http://localhost:8080/monitorix
 +
 
 +
 
 +
 
 +
== Conky Systemmonitor ==
 +
 
 +
[https://github.com/brndnmtthws/conky Conky] ist ein vielseitiger Systemmonitor für den Desktop.
 +
 
 +
[[Datei:image2020-1-14_16-37-31.png]]
 +
 
 +
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:
 +
 
 +
* Öffne das Programm "Startup Applications"
 +
* Add
 +
* [[Datei:image2020-1-14_16-39-35.png]]
 +
* Save
 +
* Close
 +
 
 +
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
 +
 
 +
 
 +
<br><br><br><br>
 +
 
 +
== 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
 +
 
 +
<br><br><br><br>
 +
 
 +
== 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
 +
 
 +
 
 +
<br><br><br><br>
 +
 
 +
 
 +
 
 +
== File Explorer ==
 +
Testen: Sunflower 0.4
 +
<br><br><br><br>
 +
 
 +
 
 +
 
 +
== 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
 +
 
 +
[[Datei:image2021-9-2_12-59-26.png]]
 +
 
 +
ask -> ok
 +
neues Zerti anwählen (aktivieren) und auf OK
 +
 
 +
[[Datei:image2021-9-2_13-0-50.png]]
 +
 
 +
Im Output sollte nunn min ein Zerti added werden:
 +
 
 +
 
 +
[[Datei:image2021-9-2_13-11-53.png]]
 +
 
 +
 
 +
'''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: ===
 +
<pre>
 +
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:~$
 +
</pre>
 +
 
 +
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
 +
 
 +
<br><br><br>
 +
 
 +
== 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
  
== WC Word Count ==
+
sudo sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
WC dient zum Zählen von Wörtern, Zeichen und Bytes in Textdateien.
+
sudo sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
 +
sudo yum update -y
  
https://wiki.ubuntuusers.de/wc/
 
  
  
 +
= Ubuntu Security Updates automatic install =
 +
In the Update Manager click the Settings button. This dialog will show up:
  
 +
screenshot of Download and install automatically security updates
  
== Host SMBus controller bus not enabled ==
+
Select the "Download and install automatically". This will automatically install security updates. If you want to set this up for them remotely via, you can do this:
Beim starten von Ubuntu 18.04 auf vmware kommt die Meldung:
 
Host SMBus controller bus not enabled
 
  
 +
sudo apt-get install unattended-upgrades
  
 +
If the package is installed already you can do:
  
First, add this line in your vmx file to increase the boot time to 50s
+
sudo dpkg-reconfigure unattended-upgrades
  
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
 
 
 
 
 
<br><br><br><br>
 
  
 
= Links =
 
= Links =
 
* [[ubuntu.com]]
 
* [[ubuntu.com]]
 
  
 
;Verzeichnis
 
;Verzeichnis

Aktuelle Version vom 7. Mai 2025, 11:38 Uhr

###--- Gott sei Dank, ich bin weg vom Fenster ---###
Linux Logo

Inhaltsverzeichnis

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

  • Kate - noch testen evt ein guter notepad++ ersatz
  • 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
  • Shutter → PM - Printscreens und mehr
  • MountManager → PM
  • CompizConfig → PM
  • Desktop Drapes
  • pyNeighborhood → PM (GUI - kleiner Mountmanager)
  • Music Applet → PM
  • Wallpaper Tray → PM - Allpet
oder:
  • UltraCopier - [2] gefällt mir schon fast besser... =)
  • Wammu - Handy SW → PM
  • gMobileMedia - Handy Datamanager SW → PM
  • 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
  • Conky - kooles Sytemresourcenanzeige Proggi --> Conky
  • Notepadqq - PM Notepad++ for Linux

Backup / Sync

  • 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!
  • 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

Sichern und Wiederherstellen einer Partition

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
  • musicGuru Musik komfortabel organisieren → neuere Ubuntuversionen Bug
  • 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

  • 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\\
  • Kdenlive - Linux Video Editor - "Easy to use" und kann sehr viel
  • Motion - kuules Cam stream and motion- detection Tool
  • Noch testen: Davinci Resolve

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

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)

Remote Administration

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
  • 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
  • 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


Sssd02.png

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

Sssd03.png

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

Sssd04.png

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

Sssd05.png

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

Docker overview.jpg

Persistent Volumes einbinden

  1. Volume im Hostsystem erstellen oder einbinden
  2. SELinux berechtigen (siehe unten)
  3. 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:

Linux gufw firewall iprange01.jpgLinux gufw firewall iprange02.jpg

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


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

Infos


Allgemein

Message Banner Login Text

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

Detailierte Doku

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

  1. 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: Image2021-7-19 10-12-3.png

  • 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:

  1. 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.

DVD_Playback_Capability]

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:

  1. Man suche vmware-vmrc im Directory .mozilla
  2. 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.

Image2020-1-14 16-37-31.png

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:

  • Öffne das Programm "Startup Applications"
  • Add
  • Image2020-1-14 16-39-35.png
  • Save
  • Close

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

Image2021-9-2 12-59-26.png

ask -> ok neues Zerti anwählen (aktivieren) und auf OK

Image2021-9-2 13-0-50.png

Im Output sollte nunn min ein Zerti added werden:


Image2021-9-2 13-11-53.png


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


Ubuntu Security Updates automatic install

In the Update Manager click the Settings button. This dialog will show up:

screenshot of Download and install automatically security updates

Select the "Download and install automatically". This will automatically install security updates. If you want to set this up for them remotely via, you can do this:

sudo apt-get install unattended-upgrades

If the package is installed already you can do:

sudo dpkg-reconfigure unattended-upgrades



Links

Verzeichnis