Debian

Aus robopagex.com
Zur Navigation springen Zur Suche springen

Journalctl

$  journalctl -b 

lid swicth

$  nano /etc/systemd/logind.conf 
 HandleLidSwitch=ignore 
 HandleLidSwitchExternalPower=ignore 
 HandleLidSwitchDocked=ignore 
$  systemctl restart systemd-logind 

Show all established connections

$  lsof -i| grep ESTABLISHED 

Listing Running Services

List all loaded services on your system

$  systemctl 
$  systemctl list-units --type=service 
$  systemctl --type=service 

List all loaded but active services

$  systemctl list-units --type=service --state=active 
$  systemctl --type=service --state=active 

Get a quick glance of all running services

$  systemctl list-units --type=service --state=running 
$  systemctl --type=service --state=running 

Stop, Disable service

$  systemctl stop [servicename] 
$  systemctl disable [servicename] 
$  rm /etc/systemd/system/[servicename] 
$  rm /etc/systemd/system/[servicename]  and symlinks that might be related
$  rm /usr/lib/systemd/system/[servicename]  
$  rm /usr/lib/systemd/system/[servicename]  and symlinks that might be related
$  systemctl daemon-reload
$  systemctl reset-failed

netstat

$  netstat -tlnp 
$  netstat -lnp 

Ports

Listing of every port available

$  less /etc/services 

Locate listening ports

$ ss -tulwn | grep LISTEN 

Kill process running on port ***

$ kill -9 `sudo lsof -t -i:3002` 

User

To add user
adduser username
You can use the following command:
$ useradd -r subversion
-r, --system                  create a system account
The -r flag will create a system user - one which does not have a password, a home dir and is unable to login.
For more info, check manual pages with this command:
$ man useradd
You will find in this documentation the following flag that can be used for your purpose.
You can use the -M switch (make sure it's a capital) to ensure no home directory will be created:
$ useradd -M subversion
then lock the account to prevent logging in:
$ usermod -L subversion


This isn't a particularly strong answer, the user created by this means still has a shell. And you did not even warn the OP that this was the case. Retrospectively that would be usermod -s /bin/false subversion, or with --shell /bin/false to useradd 
$ usermod user --shell /bin/false
To delete the user, without removing the user files, run:
deluser username
If you want to delete the user and its home directory and mail spool, use the --remove-home flag:
deluser --remove-home username

Network

$  /sbin/ifup eth0 
$  /sbin/ifdown eth0 
$  ifdown eth0 && sudo ifup eth0 
$  ip addr flush dev eth0 
$  /etc/init.d/networking restart 
$  /etc/init.d/networking stop
$  /etc/init.d/networking start
$  systemctl restart networking
$  systemctl status networking.service 
$  cat /run/network/ifstate 

Network iwlwifi Wlan

 $  apt install firmware-iwlwifi 
 $  $ modprobe -r iwlwifi ; modprobe iwlwifi 

LIST/CHECK Network Devices

Check network in kernel log [Blockchain Office]

Your list looks like:
   lo = loopback
   enp7s0 = ethernet
   lp5s0 = wlan
   virbr* = virtual bridge
   lxcbr* = lxc/lxd
   docker* = docker
   br* = docker bridge
   veth* = virtual Ethernet devices
Ue the nmcli(network manager) and run:
$ nmcli device list

For docker containers run:
$ docker network ls
$ docker network inspect [USE THE NETWORK ID FROM THE FIRST COMMAND]
Get a list of the network devices:
$ echo /sys/class/net/*
Get more informations with udevadm:
$ udevadm info -a -p /sys/class/net/[NETWORK DEVICE NAME]

Example:
$ udevadm info -a -p /sys/class/net/enp0s25
With ip:
$ ip -r link
$ ip -br link
$ ip -br -c link show
$ ip token
$ ip -s -s link show dev docker0
With lshw:
$ lshw -class network
$ lshw -class network -short

More detail information with networkctl
$ networkctl
$ networkctl status
$ networkctl status --all
Get more informations from this manpages:
   man systemd.netdev
   man systemd.link
   man systemd.network
   man7.org/linux/man-pages/man8/ip-netns.8.html 
   man7.org/linux/man-pages/man7/network_namespaces.7.html