usermod -L user01: lock the password of user01passwd: change passwordSnippets:
mkdir -p {Sij,Velj,Ozu,Tra}/{Porezna,Izlazne,Ulazne}df -hPTfree -mhps -fauxnewgrpsudo -l ili sudo -l -U usernamels -il filename: print inode numbers
a hard link points a name to data on a storage device
Table 3.2. Table of Metacharacters and Matches:
| Pattern | Matches |
|---|---|
| * | Any string of zero or more characters |
| ? | Any single character |
| [abc...] | Any one character in the enclosed class (between the square brackets) |
| [!abc...] | Any one character not in the enclosed class |
| [^abc...] | Any one character not in the enclosed class |
| [[:alpha:]] | Any alphabetic character |
| [[:lower:]] | Any lowercase character |
| [[:upper:]] | Any uppercase character |
| [[:alnum:]] | Any alphabetic character or digit |
| [[:punct:]] | Any printable character that is not a space or alphanumeric |
| [[:digit:]] | Any single digit from 0 to 9 |
| [[:space:]] | Any single white space character, which might include tabs, newlines, carriage returns, form feeds, or spaces |
man-db-cache-update: update the man pages> file: redirect stdout to overwrite a file>> file: redirect stdout to appent to a file2> file: stderr overwrite a file2> /dev/null: discard stderr> file 2>&1: redirect stdout and stderr to the same file&> file: redirect stdout and stderr to the same file>> file 2>&1: stdout and stderr to append to the same file&>> file: stdout and stderr to append to the same file$?: return value of lastfind / -name passwd 2>&1 | less: redirect both standard output and standard
error through a pipeline
set: list shell variables
HISTTIMEFORMAT="%F %T ": history time formatenv ili printenv: list all environment variablesunset file1: unset and unexport a variablesu - user -c command: run command as userusermod -L user02: lock user02/etc/login.defs: default optionsfind / -nouser -o -nogroup: find unowned files and directoriesnewgrp group01: temporarily change primary group| Permission | File | Direktory |
|---|---|---|
| Read | Open a file | List contents of directory |
| Write | Change contents of file | Create and delete files |
| Execute | Run a program file | Change to the directory |
Special permissions:
| Permission | File | Directory |
|---|---|---|
| u+s (suid) | file executes as the owner | No effect |
| g+s (sgid) | file executes the group owner | created files have group owner of the directory |
| o+t (sticky) | no effect | users with write access to the directory can remove only files that they own |
Setuid = u+s; setgit = g+s; sticky = o+t Setuid = 4; setgit = 2, sticky = 1
postconfpostconf name_of_settingpostconf -e 'name_of_setting = valuepostqueue -ppostqueue -fpostconf -e "relayhost=[smtp0.example.com]"postconf -e "inet_interface=loopback-only"postconf -e "mynetworks=127.0.0.0/8 [::1]/128postconf -e "myorigin=desktop0.example.com"postconf -e "mydestination="postconf -e "local_transport=error: local delivery disabled"systemctl reload postfixReferences:
getent hosts example.comdiggetent hosts example.comSERVFAIL: A common cause of SERVFAIL status is the failure of the DNS server to communicate with the nameservers authoritative for the name being queried.
NXDOMAIN: An NXDOMAIN status indicates that no records were found associated with the name queried. The other scenario where an NXDOMAIN status may be unexpectedly encountered is when querying a CNAME record containing an orphaned CNAME.
REFUSED: A REFUSED status indicates that the DNS server has a policy restriction which keeps it from fulfilling the client's query
systemctl stop firewalld
chattr -i /etc/resolv.con/etc/hostsgetent host.nameU dnsmasq.conf:
domain-neededbogus-priv: ???interface=ethXbind-interfacesno-resolv: ???expand-hostsdomain=mikro.localHost:
U /etc/resolv.conf:
search mikro.localnameserver 1.2.3.4/etc/named/zones/master//etc/named/zones/master/db.rhcsa.localdb.rhcsa.local:
; BIND data file for rhcsa.local
$TTL 3h
@ IN SOA ns1.rhcsa.local. admin.rhcsa.local (
1 ; Serial (broj promjena u fajlu)
3h ; Refrash
1h ; Retry
1w ; Expire
1h ; Negative cache TTL )
;
@ IN NS ns1.rhcsa.local.
rhcsa.local. IN A 172.25.250.11
ns1 IN A 172.25.250.11
servera IN A 10.10.20.10
serverb IN A 10.10.20.20
serverc IN A 10.10.20.30
email IN A 10.10.20.40
db.172.25.250:
10.20.10.10.in-addr.arpa. IN PTR servera
/etc/named.conf:
zone "rhcsa.local" {
type master;
file "/etc/named/zones/master/db.rhcsa.local"; }
listen-onallow-querynslookup -type=mx mikro.localmx-host=mail.mikro.local 10/etc/postfix/main.cf:
myhostname = mail.mikro.localmydomain = mikro.localmyorigin = $mydomaininet_interfaces = allmydestination = ..., ..., $mydomainmynetworks = ..., ..., ..., 172.25.250.0/24telnet mail.mikro.local 25MAIL FROM:whatever@somethingRCPT TO:someone@somethingDATA: textExit with ctrl + đ, ili ctrl + ]
set synchronize-panesmount -ravgetent hostsrpm -qadnf list --installeddnf history infopartprobe ili udevadm settlemkswap /dev/vdb3/dev/vdb3 swap swap defaults 0 0hostnamectl set-hostname "name"timedatectl set-ntp falseApache:
<VirtualHost *:80>
ServerName my.domain.local
DocumentRoot /var/www/path_to_dir
ErroLog /var/log/path_to_file
CustomLog /var/log/path_to_file combined
</VirtualHost>
nginx:
server{
server_name www.nginx.local;
listen 80;
root /var/www/www_nginx_local/;
error_log /var/log/www_nginx_err.log;
access_log /var/log/www_nginx_local.log;
[root@host ~]# parted /dev/vdb mklabel gpt mkpart primary 1MiB 769MiB
...output omitted...
[root@host ~]# parted /dev/vdb mkpart primary 770MiB 1026MiB
[root@host ~]# parted /dev/vdb set 1 lvm on
[root@host ~]# parted /dev/vdb set 2 lvm on
pvcreate /dev/vdb1 /dev/vdb2vgcreate vgname /dev/vdb1 /dev/vdb2lvcreate -n lvname -L 100M vgnamemkfs -t xfs /dev/vgname/lvnamemount ...Display status:
pvdisplay /dev/vdb1vgdisplay /dev/vg01lvdisplay /dev/lv01pvsvgslvsvgextend vg01 /dev/vdb3lvextend -L +500M /dev/vg01/lv01 ili lvextend -r -L +500M /dev/vg01/lv01xfs_growfs /mnt/lvmount ili resizefs /dev/vg01/lv01pvmove /dev/vdb3vgreduce vg01 /dev/vdb3Commands: lvremove, vgremove, and pvremove
swapoff -v /dev/vg01/swaplvextend -L +300M /dev/vg01/swapmkswap /dev/vg01/swapswapon /dev/vg01/swapdnf install vdo kmod-kvdolvcreate --type vdo --name vdo-lv01 --size 5G vg01dnf install stratis-cli stratisdsystemctl enable --now stratisdstratis pool create pool1 /dev/vdbstratis pool liststratis pool add-data pool1 /dev/vdcstratis blockdev list pool1stratis filesystem create pool1 fs1stratis filesystem liststratis filesystem snapshot pool1 fs1 snapshot1fstab:
UUID=c7b57190-8fba-463e-8ec8-29c80703d45e /dir1 xfs defaults,x-systemd.requires=stratisd.service 0 0
yum groupinstall mariadb mariadb-clientsystemctl start mariadb
port 3306
firewall-cmd --permanent --add-service=mysqlfirewall-cmd --reload/etc/my.cnfbind-addressskip-networking=1mysql_secure_installation(1)mysql -u root -h localhost -p: connectSQL:
SHOW DATABASES;CREATE DATABASE inventory;USE inventory;DESCRIBE servers;delete from table where id = x;update table set column1=value1, column2=value2 where id = x;Inserting:
INSERT INTO product(name,price,stock,id_category,id_manufacturer)
VALUES ('SDSSDP-128G-G25 2.5',82.04,30,3,1);
Access rights:
CREATE USER username@hostname IDENTIFIED BY 'password';SELECT host,user,password FROM user WHERE user = 'username';
username@'localhost': User mobius can connect just from localhost.
mobius@'192.168.1.5': User mobius can connect from 192.168.1.5 host.mobius@'192.168.1.%': User mobius can connect from any host that belongs to the network 192.168.1.0.mobius@'%': User mobius can connect from any host.mobius@'2000:472:18:b51:c32:a21': User mobius can connect from 2000:472:18:b51:c32:a21 host.
GRANT SELECT, UPDATE, DELETE, INSERT on inventory.category to user username.hostname;
REVOKE SELECT, UPDATE, DELETE, INSERT on inventory.category to user username.hostname;SHOW GRANTS FOR root@localhost;FLUSH PRIVILEGES;Logical backup:
mysqldump -u root -p inventory > /backup/inventory.dumpmysqldump -u root -p --all-databases > /backup/mariadb.dumpmysql -u root -p inventory < /backup/mariadb.dump--add-drop-table--no-data--lock-all-tables--add-drop-databasePhysical:
mysql -u root -pFLUSH TABLES WITH READ LOCK;UNLOCK TABLES;firewall-cmdfirewall-cmd --list-all-zonesfirewall-cmd --add-service http --zone publicfirewall-cmd --remove-service http --zone publicsystemctl reload firewalldfirewall-cmd --runtime-to-permanentfirewall-cmd --get-servicestuned-adm list/usr/lib/tuned/virtual-guest/tuned.confsysctl vm.dirty_ratiosysctl vm.swapinesstuned-adm profile throughput-performancetuned-adm activeps -o pid,pcpu,nice,comm $(pgrep command)selinux=0 kernel parameter at bootenforcing=1 kernel parameter at boot
Config file: /etc/selinux/configpolicycoreutils-python-utils
semanage fcontext -a -t httpd_sys_content_t '/app(/.*)?'
restorecon -RFvv /path/to/something
cp --preserve=context
semanage fcontext -lsemanage -a, --add: add a recordsemanage -d, --delete: delete a recordsemanage -l, --list: list recordssemanage fcontext -a -t httpd_sys_content_t '/virtual(/.*)?'semanage fcontext -l -Csemanage boolean -l | grep httpd_enable_homedirsgetsebool httpd_enable_homedirssemanage boolean -l -Csetsebool -P httpd_enable_homedirs onSee: - getenforce(8) - setenforce(8) - linux_config(5)
find /path -type f -name "*.bla"