Debian
Version vom 18. Februar 2022, 16:29 Uhr von Geist (Diskussion | Beiträge)
Inhaltsverzeichnis
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 $ 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