今日已更新 255 条资讯 | 累计 37160 条内容
关于我们

Restrict Cron Access

Janak Shrestha 2026年08月29日 11:31 1 次阅读 来源:Dev.to

In alignment with security compliance standards, the Nautilus project team has opted to impose restrictions on crontab access. Specifically, only designated users will be permitted to create or update cron jobs. Configure crontab access on App Server 3 as follows: Allow crontab access to rose user while denying access to the rod user. Solution Step 1: Connect to App Server 3 (stapp03) ssh banner@stapp03 # Password: BigGr33n Step 2: Switch to root or use sudo sudo su - # Password: BigGr33n Step 3: Create the cron.allow file with user rose echo "rose" > /etc/cron.allow Step 4: Add rod to cron.deny file (optional but ensures denial) echo "rod" >> /etc/cron.deny Note: If cron.allow exists, cron.deny is ignored. However, it's good practice to maintain both. Step 5: Verify the configuration # Check cron.allow file cat /etc/cron.allow # Check cron.deny file cat /etc/cron.deny # Test rose user access su - rose -c "crontab -l" 2>&1 # Test rod user access su - rod -c "crontab -l" 2>&1 Complete One-Line Commands From jump host with password: echo 'BigGr33n' | ssh banner@stapp03 "sudo -S bash -c 'echo rose > /etc/cron.allow && echo rod > /etc/cron.deny && echo \" === cron.allow === \" && cat /etc/cron.allow && echo \" === cron.deny === \" && cat /etc/cron.deny'" From jump host using heredoc: ssh banner@stapp03 << ' EOF ' echo 'BigGr33n' | sudo -S bash -c ' echo "Creating cron.allow with rose..." echo "rose" > /etc/cron.allow echo "Creating cron.deny with rod..." echo "rod" > /etc/cron.deny echo "" echo "=== Verification ===" echo "cron.allow contents:" cat /etc/cron.allow echo "" echo "cron.deny contents:" cat /etc/cron.deny echo "" echo "Testing rose user (should have access):" su - rose -c "crontab -l" 2>&1 || echo "No crontab for rose (expected)" echo "" echo "Testing rod user (should be denied):" su - rod -c "crontab -l" 2>&1 ' EOF Step-by-Step Interactive Commands # Connect to stapp03 ssh banner@stapp03 # Enter password: BigGr33n # Become root sudo su - # Enter password: B

本文内容来源于互联网,版权归原作者所有
查看原文