#infosec #cybersecurity #cybersecuritytips #pentesting #oscp #redteam #informationsecurity #cissp #CyberSec #networking #networksecurity #CheatSheet #infosecurity #cyberattacks #security #linux #databreach #vulnerabilities #bugbounty #bugbountytips
10 10 1 * * /tmp/test.sh
The above creates a cron job that executes every 10:10 AM each month on the first day.
Determining the last day of the month can be challenging as some months have 28, 29, 30, or 31 as the last date. Besides, the field for the Day_of_Month takes a specific day and giving it a list of possible days would execute on an incorrect day.
The trick is to specify a command that checks if the next day is the first day of the month. If so, it means the current day is the last of that month and the cron job can then execute.
The command below checks and returns tomorrow’s date:
date +%d -d tomorrow
we can set it to run our cron job.
The new command would be:
30 13 28-31 * * [ "$(date +\%d -d tomorrow)" = "01" ] && /tmp/test.sh
Sometimes we don't want normal users to provide sudo rights. but we want to run some scripts which can only run with the sudo.
in that case we can set user rights that will run only specific script with sudo privilleges.
You can perform this by three ways.
Method 1:
Create file (vim /etc/sudoers.d/iosys) and add below lines in created file.
username ALL=NOPASSWD:/command/to/execute
username ALL=NOPASSWD:/command/to/execute
Note: Change username accordingly.
Method 2:
Open below configuration file, and made provided changes into it.
nano /etc/sudoersEdit it with below lines,
# User privilege specification
root ALL=(ALL:ALL) ALL
ALL ALL =(root) NOPASSWD:/command/to/execute# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
%sudo ALL=NOPASSWD:/command/to/execute With using below steps you can block and Allow specific IPs to take SSH without using iptables and Firewall.
Open below file,
cat /etc/hosts.allow
sshd: 192.168.0.13 : allow
sshd: ALL : deny
This will allow SSH for 192.168.0.13 IP only.
Mouse M3 button not working in wayland - ubuntu 26.04 1. Check your desktop Run: echo $XDG_SESSION_TYPE echo $XDG_CURRENT_DESKTOP 2. If...