Quite often, we need to allow users to be able to edit files that only root can edit. Obviously we can’t provide them full root access 😉 This situation takes us to sudoers file. Adding a simple line to the sudoers file can make this happen.
test_user ALL=(ALL) NOPASSWD: /bin/vi /etc/profile
Adding this line will enable test_user to edit /etc/profile file without needing to enter password. It just needs to enter sudo vi /etc/profile 🙂