Ubuntu rc.local Configuration Guide

To configure the rc.local file in Ubuntu, follow these steps:

  1. Open the rc.local file for editing by entering the following command in the terminal:
sudo nano /etc/rc.local
  1. Edit the rc.local file:
    In the rc.local file, add the commands or scripts that need to be automatically run when the system starts up. Make sure to add these commands before “exit 0” as it signifies the end of the file.
  2. Save and exit:
    Press Ctrl + X, then press Y to confirm saving, and finally press Enter to exit the editor.
  3. To grant executable permission to the rc.local file:
    Enter the following command in the terminal to ensure that the rc.local file has executable permission:
sudo chmod +x /etc/rc.local
  1. Reboot the system: Finally, restart the system to apply the changes.
sudo reboot

The steps to configure the rc.local file in Ubuntu are provided above. It is important to note that Ubuntu 18.04 and higher versions use systemd as the startup manager, so using the rc.local file in these versions is not recommended. Instead, it is recommended to use systemd unit files to manage startup scripts.

bannerAds