Skip to content
Scatlion
Linux

How to allow commands to be run without sudo

Running deployment scripts for CI/CD pipelines sometimes require root user privileges for reboot tools. We can allow our current user to run these tools without sudo and interrupting the process for password prompts.

1 min read

When we run a deploy script on our server, it's sometimes necessary to restart various tools like PHP or Node process - especially when running a Node renderer process for server side rendering.

These tools require root password, which can stop the deploy process. To avoid this issue we can whitelist some commands that a user can run, without requiring elevated permissions.

Example:

TEXT
{linux_user} ALL=(root) NOPASSWD: /usr/bin/systemctl reload php8.5-fpm