Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I want to automatically login as root, and then run an interactive script. I am using Fedora 16.

share|improve this question
    
Console or X Windows? Do you need to only have one console available? –  Mel Boyce Jun 30 '13 at 10:07

2 Answers 2

I concurr with @vonbrand that logging in as root is dangerous. However, if you want to do this, and the script can be written in a way that it doesn't need access to the UI (you could use expect, move required input to configuration files, or something along the lines of that), you can do it by adding a crontab rule that triggers on reboot. That is pretty universally supported.

You would do it by adding a crontab entry which, instead of the usual time fields, uses the special string @reboot.

For example, I have the following crontab entry in root's crontab, intended to populate the RAM cache with the entire file system structure to speed up disk accesses:

@reboot  /usr/bin/nice -n 19 /usr/bin/find / >/dev/null 2>&1

See man 5 crontab for a complete list of the special strings supported.

share|improve this answer

Logging in as root is dangerous, as root is all-powerful. You'll learn the hard way when you do a "rm -rf *" at the wrong place.

If you want to run some program as root each boot, you should set up systemd so it is launched each time. Look at the relevant manpages, and perhaps pilfer some ideas from e.g. the files referenced in /lib/systemd/system/sysinit.target.wants

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.