110.1 Perform Security Administration Tasks Flashcards
Gain privileges for user bob, load bob’s home directory and environment variables.
su - bob
Executes a command as user moo and immediately returns to your user account.
su -c some_command moo
Shows who is logged on and what they are doing.
w
Shows who is currently logged in.
who
Shows the history of user login and logout along with the time and date.
last
Scan all devices on the 192.168.1.0 network for open ports, timing 5 seconds.
nmap -T5 192.168.1.0/24
Scan all hosts on 192.168.1.0 network for ports 1-12345, treat all hosts as online to avoid ICMP (ping).
nmap -Pn -p1-12345 192.168.1.0/24
Scan all devices on the 192.168.1.0 network and determine the operating systems for each host.
sudo nmap -O 192.168.1.0/24
Show protocol statistics for IP, TCP, UDP, ICMP.
netstat -s
Show the routing table.
netstat -r
Show all ports on the network in numeric format.
netstat -na
Show only listening sockets in numeric format.
netstat -nl
Find out which process is using port 33737/tcp, verbose.
fuser -v -n tcp 33737
List open files for device sda3, like a USB flash drive needing to be unmounted.
lsof | grep ‘/dev/sda3’
List processes listening on port 23.
lsof -i :23
Kills all processes using the Data file system or folder so that it can be unmounted.
fuser -km Data
Find files owned by root under / with mounted filesystems excluded and suid or sgid bit set.
find / -xdev -user root ( -perm -4000 -o -perm -2000 )
find / -xdev -user root ( -perm /u=s -o -perm /g=s )
Find files in home directory modified in the last 24 hours (last access time / 24 with remainder < 24).
find $HOME -mtime 0
Find files in home directory modified in the last 24 hours, exclude hidden files and directories.
find $HOME ( ! -regex ‘./..’ ) -mtime 0
Where is the EDITOR environment variable set?
~/.bashrc