Linux 061225


http://www.linux.org/



ejectUSB



uname -A
/etc/issue
df -AH/AK
service [udev] status/start/stop
systemctl status [service-dev]
du/dv -SH Katalog
grep -nr "dnssec-enable" /etc/

/var/log/auth.log


find / -type d -iname xxxxyyy ps aux | grep [ngix]
ls /mnt
mount /dev/sda2
/mnt
mount
less /etc/fstab



du -ha
dd if=/dev/zero of=obraz.img bs=1 count=0 seek=100M
ls -lah
mkfs.ext2 ./obraz.img
debugfs
fallocate -n -l 100M plik


exec 3<>/dev/tcp/example.com/80
echo -ne "GET / HTTP/1.1\r\nHost: example.org\r\n\r\n" >&3
cat <&3


ls -lad
(d|r-ls,w-rename/delete/create,x-cd/gothrough,t-owneronly
ls -la
ls -


getfacl
setfacl -m u:(user:r/w/x /folder/file


ln -s (what name


systemctl daemon-reload

sudo dd if=/home/gtriderxc/Pobrane/archlinux-2020.02.01-x86_64.iso of=/dev/sdb bs=4M status=progress && sync

sysctl vm.swappiness= //etc/sysctl.conf


sudo systemctl restart NetworkManager.service

sudo iw dev wlp12s0 get power_save

sudo iw dev wlp12s0 set power_save off

sudo iw dev wlp12s0 get power_save

==================EJECTINGdrives=========================================================================
https://unix.stackexchange.com/questions/35508/eject-usb-drives-eject-command
sudo eject /dev/sdc && sudo udisksctl power-off -b /dev/sdc
systemctl enable --now atd
sudo eject /dev/sdc && sudo udisksctl power-off -b /dev/sdc | at now + 1 minutes hours

seconds=20
start="$(($(date +%s) + $seconds))"
while [ "$start" -ge `date +%s` ]; do
time="$(( $start - `date +%s` ))"
printf '%s\r' "$(date -u -d "@$time" +%H:%M:%S)"
done



sudo systemctl mask systemd-backlight@leds\:dell\:\:kbd_backlight.service

Step 1: as stated above
Edit file
/etc/dbus-1/system.d/org.freedesktop.UPower.conf

change:

to:
send_interface="org.freedesktop.UPower.KbdBacklight"/>

Step 2: Bios

In my bios file I had to find the settings for the keyboard timeout and change it to something else. So if it was set to 5 seconds then I had to change it to 10 seconds. If it was set to 10 seconds then I had to change it to 5 seconds.

https://bugs.launchpad.net/dell-sputnik/+bug/1510344?comments=all

VirtualBox -style Fusion %U

VirtualBox error: Kernel driver not installed (rc=-1908)

sudo aptitude update

sudo aptitude install dkms

sudo /etc/init.d/vboxdrv setup


-----------------------
timedatectl status
timedatectl
set-local-rtc
timedatectl set-ntp true
timedatectl timesync-status
systemctl status sgrep -nr "dnssec-enable" /etc/ystemd-timesyncd systemd-networkd


systemctl status ntp
/etc/ntp.conf
/lib/systemd/system/ntp.service


hwclock --update-drift


?? systemctl restart systemd-networkd


sudo systemctl mask systemd-backlight@leds\:dell\:\:kbd_backlight.service

/etc/ntp.conf
/var/log/ntpstats/
ntpq -pn
ntpq -c rv
--------------------------------

systemctl list-unit-files --state=enabled
resolvectl status


-----------------------------------------------------------

 

Przywracanie Grub 2 po instalacji Windows:

sudo su
mkdir /mnt/root
mount -t ext3 /dev/sda6 /mnt/root
mount -t proc none /mnt/root/proc
mount -o bind /dev /mnt/root/dev
chroot /mnt/root /bin/bash
grub-install /dev/sda

W razie błędów:
grub-install --recheck /dev/sda

Później po uruchomieniu Ubuntu aktualizacja wpisów:
sudo grub-update

---------------------------------------------------

Dodanie Win do Grub 2:

sudo aptitude install os-prober

Potem:
sudo update-grub2

--------------------------

fdisk /fixboot
fdisk /mbr

---------------------------------------------------

sudo systemctl mask systemd-backlight@leds\:dell\:\:kbd_backlight.service

Step 1: as stated above
Edit file
/etc/dbus-1/system.d/org.freedesktop.UPower.conf

change:

to:
send_interface="org.freedesktop.UPower.KbdBacklight"/>

Step 2: Bios

In my bios file I had to find the settings for the keyboard timeout and change it to something else. So if it was set to 5 seconds then I had to change it to 10 seconds. If it was set to 10 seconds then I had to change it to 5 seconds.

https://bugs.launchpad.net/dell-sputnik/+bug/1510344?comments=all
x:boot\bootsect.exe /nt52 ALL /force

---------------------------------------------------



--mask
Do recalculate the effective rights mask, even if an ACL mask entry
was explicitly given. (See the -m option.)

Manual page setfacl(1) line 69 (press h for help or q to quit)

-rw-r--r--. 1 root root 100 Feb 11 2022 .cshrc
-rw-------. 1 root root 56 Oct 13 22:49 .lesshst
drwx------. 2 root root 4096 Oct 13 19:52 .ssh
-rw-r--r--. 1 root root 129 Feb 11 2022 .tcshrc
-rw-------. 1 root root 13175 Oct 13 19:53 .viminfo

[root@alma9 ~]# echo qwerty > test
[root@alma9 ~]# lsattr test
---------------- test
[root@alma9 ~]# chattr +i test
[root@alma9 ~]# cat test
qwerty
[root@alma9 ~]# echo aaaa > test
-bash: test: Operation not permitted
[root@alma9 ~]# rm test
rm: remove regular file 'test'? y
rm: cannot remove 'test': Operation not permitted
[root@alma9 ~]# ls -l test
-rw-r--r--. 1 root root 7 Oct 14 20:02 test
[root@alma9 ~]#



chrony:!!:2000::::::
sshd:!!:2000::::::
tcpdump:!!:2000::::::
stefan:$6$0.m0ju.nnkRoCl93ISh1xj2NHRcvQGJaIKXE4bmIJz0JNLiI8GiwCB.7cvXd9.tWeLMI0WhMtv4c30GvTKsmmJizUZ/vTWsBKKvekKq0:20010:0:99999:7:::
zofia:$6$bYHl1HYiYzT8KfFSq$BRLryYvtrss3ALzMdN9EYvhkko5d45O7WsNkQX.BJvTL.ZOIxthietpNEyoIhYXYvgydnUkcLzYjNRJ3EbgRa5I:20000:0:99999:7:::
apache:!!:2000::::::
nginx:!!:2000::::::


[stefan@alma9 ~]$
[stefan@alma9 ~]$ cat /etc/shadow


stefan 40947 40946 0 19:25 pts/0 00:00:00 -bash
root 40977 38684 0 19:25 ? 00:00:00 [kworker/0:2-cgroup_destroy]
root 40987 40977 0 19:25 ? 00:00:00 sshd: root [priv]
root 41007 40987 0 19:25 pts/1 00:00:00 sshd: root@pts/1
root 41033 41007 0 19:29 pts/1 00:00:00 -bash
root 41063 41033 0 19:29 pts/1 00:00:00 passwd
root 41064 41033 0 19:29 pts/1 00:00:00 ps -ef


[root@alma9 ~]# chmod u+s /usr/bin/cat
[root@alma9 ~]# ls -la /usr/bin/cat
-rwsr-xr-x. 1 root root 36312 Apr 2 2024 /usr/bin/cat
[root@alma9 ~]#





Prawa „tradycyjnie”

Prawa specjalne:
setuid (u+s) = 4
setgid (g+s) = 2
sticky bit* (o+t) = 1

*restricted deletion

Przykłady:
rwxrwxr-x = 0775 (775)
rwsr-xr-x = 4755
rwxrws--- = 2770
rwxrwxrwt = 1777

-rwxr-xr-x. 1 root root 140752 Apr 2 2024 /usr/bin/ls
[stefan@alma9 ~]$ ls -l /usr/bin/vim
-rwxr-xr-x. 1 root root 4024440 Feb 28 2023 /usr/bin/vim
[stefan@alma9 ~]$ ls -l /usr/bin/passwd
-rwsr-xr-x. 1 root root 32656 Apr 14 2022 /usr/bin/passwd
[stefan@alma9 ~]$ vim
[stefan@alma9 ~]$ passwd
Changing password for user stefan.
Current password:
[stefan@alma9 ~]$


root 40942 2 0 19:25 ? 00:00:00 [kworker/1:3-events]
stefan 40947 40946 0 19:25 pts/0 00:00:00 -bash
root 40974 40947 0 19:25 ? 00:00:00 sshd: stefan [priv]
stefan 40975 40974 0 19:25 ? 00:00:00 sshd: stefan@pts/0
root 40977 38647 0 19:25 ? 00:00:00 [kworker/0:2-cgroup_destroy]
root 41007 40987 0 19:25 pts/1 00:00:00 sshd: root [priv]
root 41033 41007 0 19:29 pts/1 00:00:00 -bash
root 41063 41033 0 19:29 pts/1 00:00:00 passwd
root 41064 41033 0 19:29 pts/1 00:00:00 ps -ef
[root@alma9 ~]#



[stefan@alma9 ~]$


-r, --system create a system account
-R, --root CHROOT_DIR directory to chroot into
-P, --prefix PREFIX_DI directory prefix
-U, --users USERS list of user members of this group

[root@alma9 ~]# groupadd zespol
[root@alma9 ~]# gpasswd -a stefan zespol
Adding user stefan to group zespol
[root@alma9 ~]# gpasswd -a zofia zespol
Adding user zofia to group zespol
[root@alma9 ~]#


cat access.log | grep 10.0.0.116 | awk '/22\/Sep\/2016:13:30/{y=1}y' | grep "22/Sep/2016:13:33:19" -B 10000 | cut -d " " -f 7 | cut -d "/" -f 3 | sort | uniq -c | sort -nr


x


x