RHKN

Lernen

Lernen


Kartei Details

Karten 67
Sprache Deutsch
Kategorie Technik
Stufe Andere
Erstellt / Aktualisiert 03.02.2025 / 03.02.2025
Weblink
https://card2brain.ch/box/20250203_rhkn
Einbinden
<iframe src="https://card2brain.ch/box/20250203_rhkn/embed" width="780" height="150" scrolling="no" frameborder="0"></iframe>

Add user lisa with uid 1234 and group sales

- groupadd sales
- useradd -u 1234 -G sales lisa

Add user linda but with no login prompt

- useradd -s /usr/sbin/nologin linda

Hinzufügen von user Lisa und hinzufügen der Gruppe Sales

- usermod -aG sales lisa

NTP

- vi /etc/crony.conf
- adapt pool line
- systemctl restart chronyd

vorlage von einem Cron

- cat /etc/crontab

ausführen eines cron als user lisa and logg hello

crontab -e -u <username>

- 0 2 * * 1-5 logger "hello"

Alle neue erstellten dateien gehören zur Gruppe

- chmod g+s d1/

Löschen kann nur der Besitzer oder root Files im Directory

- chmod +t d1/

NFS einrichten (NFS Server)

- vi /etc/hosts

- mkdir /home/ldap/ldapuser{1..9}

- dnf install nfs-utils

- vi /etc/exports

- /home/ldap *(rw,no_root_squash)

- systemctl enable --now nfs-server

- showmount -e localhost (Testing)

- firewall-cmd --add-service=(mountd, nfs, rpc-bind) --permanent

- systemctl reload firewalld.service

NFS (NFS Client)

- vi /etc/hosts

- showmount -e rhcsaserver

- dnf install autofs

- vi /etc/auto.master

- /homes /etc/auto.homes

- vi /etc/auto.homes

- * -rw rhcsaserver:/home/ldap/&

- systemctl enable --now autofs

Ändere httpd.service für port 82 

- dnf install selinux-policy-doc

- dnf install httpd

- vi /etc/httpd/conf/httpd.conf  
 80 > 82

- man semanage-port
copy example code

- systemctl restart httpd

SELinux mit anderem filecontext: Beispiel /web folder httpd

man semanage-fcontext -> /web copy zeile

restorecon -R -v /dir

SSH

ssh-keygen (key genereiren)

vi /etc/hosts (Eintrag des Servers)

ssh-copy-id <name vom hosts eintrag> (Public key zum zielserver kopieren)

Probleme mit /.autorelabel

mount -o remount,rw /
rm -rf /.autorelabel
restorecon -Rv /

Anzeige der konfigurieten Time date Settings

timedatectl status

Building Images from Containerfile

podman build -t i<magename> <pathContainerFile>

Anzeigen der defualt extends, set to 2M

vgdisplay

- -s 2M ond vgcreate

copy test.txt to every new useradd

cp text.txt /etc/skel

suche files ggrösser 200M und ls -d

find / -size +200M -type f -exec ls -l {} \;

but command sleep inifity with lowest prio in student auto start config

echo "nice -n 19 sleep infinity &" >> .bash_profile 

Use systemd mount that is provided by default to mount the /tmp directory persistently using tmpfs driver (without fstab)

systemctl enable tmp.mount (wihtout --now)

create a simple systemd unit with sleep.service
- sleep 3600 command

- unit is stored in the appropriate location

- unit is automatically startet in mutil-user.target

if ist stops für any reasen it will automatically restart

cp /usr/lib/systemd/system/tuned.service /etc/systemd/system/sleep.service

vi:
- Description=Sleep3600
- Type=Simple
- ExecStart=/usr/bin/sleep 3600
- Restart=on-failure

-WantedBy=multi-user.target

 

Systemctl enable sleep.service

systemctl start sleep.service

checke deine registries fpr container

grep unqualified /etc/containers/registries.conf

Wo setzt man ein Label das man für fstab auch noch verwenden kann?

mkfs.xzz -L LABELNAME /dev/sda3

find all files and dir whicht is created by user natasha an copy it to /root/natashafiles

find / -user natasha -exec cp -rf {} /root/natashafiles/ \;

wo sollen lokale skripts platziert werden?

/usr/local/bin

Build applicatio rhcsa that m^orint message when logged in as ablerate user

vi /usr/local/bin/rhcsa

- #!/bin/bash

echo "Welcome etc"

 

paste /usr/local/bin/rhcsa in file    in.   /home/user/.bash_profile