Hello folks,
Just curious, per this post: viewtopic.php?p=819252#p819252
D.O. says to put this command, that requires sudo to run, "put this command in /etc/rc.local, just above the "exit 0" that is in the file by default."
I don't know scripts, and I usually put commands in Session and Startup - or Keyboard Shortcut, but can ALL, MOST, and/or only SPECIFIC commands be place in
/etc/rc.local?
Or, any general comments regarding placing sudo commands in "/etc/rc.local", or any other relatively easy methods of "automatically" running sudo commands?.
Again, just curious.
Thanks
sudo commands in /etc/rc.local
- dolphin_oracle
- Developer
- Posts: 22460
- Joined: Sun Dec 16, 2007 12:17 pm
Re: sudo commands in /etc/rc.local
Session and Startup processes commands at user level, at login to the Xfce desktop. (other desktop environments have similar)
rc.local processes commands as root. There is a difference between sysVinit and systemd when that file is processed. sysVinit processes that file before login. systemd *might* process the file after login, because systemd does things in parallel and it sort of depends how fast you login when that file gets processed. Still processes as root, just may happen later in the startup than one might otherwise expect.
So it depends on what you want to do what is appropriate.
rc.local processes commands as root. There is a difference between sysVinit and systemd when that file is processed. sysVinit processes that file before login. systemd *might* process the file after login, because systemd does things in parallel and it sort of depends how fast you login when that file gets processed. Still processes as root, just may happen later in the startup than one might otherwise expect.
So it depends on what you want to do what is appropriate.
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad X1 Extreme Gen 4 - MX-23
FYI: mx "test" repo is not the same thing as debian testing repo.
Live system help document: https://mxlinux.org/wiki/help-antix-live-usb-system/
lenovo ThinkPad X1 Extreme Gen 4 - MX-23
FYI: mx "test" repo is not the same thing as debian testing repo.
Live system help document: https://mxlinux.org/wiki/help-antix-live-usb-system/
Re: sudo commands in /etc/rc.local
I dont know if this qualifies for your "automatically running" but the following certainly makes my life easier. There are a number of things I run daily, or multiple times daily, that 'require' sudo and I use the following to remove that requirement.MXRobo wrote: Wed May 14, 2025 10:14 am
Or, any general comments regarding placing sudo commands in "/etc/rc.local", or any other relatively easy methods of "automatically" running sudo commands?.
Again, just curious.
Thanks
1) Create a new file in the /etc/sudoers.d folder for your application you want to run. (In this example I created: crashplanservice
2) In that file, enter the path to the application your trying to launch, formatted as follows:
Code: Select all
# sudoers file.
%users ALL=(root) NOPASSWD: /usr/local/crashplan/bin/CrashPlanService
Code: Select all
alias CrashPlanService='sudo /usr/local/crashplan/bin/CrashPlanService'
Code: Select all
CrashPlanService
I use this to restart services that get high on ram over time, or to start some applications that require sudo.
There are always some security risks to doing this when your talking about automating 'sudo' rights, but using restraint and understanding WHAT your running is the key imo.
*QSI = Quick System Info from menu (Copy for Forum)
*MXPI = MX Package Installer
*Please check the solved checkbox on the post that solved it.
*Linux -This is the way!
*MXPI = MX Package Installer
*Please check the solved checkbox on the post that solved it.
*Linux -This is the way!