Notes On Linux System Administration
Check avaiable resources
- Avaliable memory: in
/proc/meminfo
free -h
# total used free shared buff/cache available
#Mem: 30G 5.3G 18G 120M 7.4G 25G
#Swap: 8.0G 2.0G 6.0G
Daemon process
- Configuration files of systemd
- Not modify
/usr/lib/systemd/system/lib/systemd/system
- Can be customized
/etc/systemd/system/run/systemd/system
- Not modify
- List avaiable service
systemctl list-units --type=service
systemctl list-unit-files --type=service
- Show logging
journalctl
ssh login without typing password
- Append local public key
~/.ssh/id_rsa.pubto~/.ssh/authorized_keysin remote machine should work
crontab
- Configuration:
minute(s) hour(s) day(s) month(s) weekday(s) command(s) /var/spool/cron/crontabs- See https://kb.iu.edu/d/afiz
Account management
- Add account
adduser: a system command, not create home directoryuseradd: a perl wrapper for adduser, create home directory
- Remove account
userdel -r {user.name}
- Change user group
usermod -a -G {group.name} {user.name}
Network file system (NFS)
NIS, LDAP and single sign on
- LDAP (Lightweight Directory Access Protocol)
-
PAM (Pluggable Authentication Module system)
- https://blog.csdn.net/developerinit/article/details/76141065
- Show all user with access
getent passwd
- Show password specific to LDAP
getent passwd --service=ldap
Security related topics
-
/var/log/secureprovides useful loggings -
Do not log in as root
-
https://www.liquidweb.com/kb/how-do-i-set-up-setuid-setgid-and-sticky-bits-on-linux/
-
modify timestamp
touch -t 202001010000.00 test.txt
# use -t -h for symlink