# systat -tcp 1# BSD tcp connections (try also -ip)# systat -netstat 1# BSD active network connections# systat -ifstat 1# BSD network traffic through active interfaces# systat -iostat 1# BSD CPU and and disk throughput# tail -n 500 /var/log/messages# Last 500 kernel/syslog messages# tail /var/log/warn# System warnings messages see syslog.conf
1.3Users
# id# Show the active user id with login and group# last# Show last logins on the system# who# Show who is logged on the system# groupadd admin# Add group "admin" and user colin (Linux/Solaris)# useradd -c "Colin Barschel" -g admin -m colin# userdel colin# Delete user colin (Linux/Solaris)# adduser joe# FreeBSD add user joe (interactive)# rmuser joe# FreeBSD delete user joe (interactive)# pw groupadd admin# Use pw on FreeBSD# pw groupmod admin -m newmember# Add a new member to a group# pw useradd colin -c "Colin Barschel" -g admin -m -s /bin/tcsh# pw userdel colin; pw groupdel admin
Encryptedpasswordsarestoredin/etc/shadowforLinuxandSolarisand/etc/master.passwdonFreeBSD.Ifthemaster.passwdismodifiedmanually(saytodeleteapassword),run
#pwd_mkdb-p master.passwd
to rebuild the database.Totemporarilypreventloginssystemwide(forallusersbutroot)usenologin.Themessageinnologin will be displayed (might not work with ssh pre-shared keys).
# echo "Sorry no login now" > /etc/nologin# (Linux)# echo "Sorry no login now" > /var/run/nologin# (FreeBSD)
1.4Limits
Someapplicationrequirehigherlimitsonopenfilesandsockets(likeaproxywebserver,database). The default limits are usually too low.
Linux
Per shell/script
Theshelllimitsaregovernedby
ulimit
.Thestatusischeckedwith
ulimit-a
.Forexampletochange the open files limit from 1024 to 10240 do:
# ulimit -n 10240# This is only valid within the shell
The
ulimit
command can be used in a script to change the limits for the script only.
Per user/process
Login users and applications can be configured in
/etc/security/limits.conf
. For example:
# cat /etc/security/limits.conf* hard nproc 250# Limit user processesasterisk hard nofile 409600# Limit application open files
System wide
Kernel limits are set with sysctl. Permanent limits are set in
/etc/sysctl.conf
.
# sysctl -a# View all system limits# sysctl fs.file-max# View max open files limit# sysctl fs.file-max=102400# Change max open files limit# echo "1024 50000" > /proc/sys/net/ipv4/ip_local_port_range# port range
— System —
3
Leave a Comment