Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

J@ffa

macrumors 6502a
Original poster
Jul 21, 2002
688
51
Behind you!
Hey all. I'm trying to figure out something that probably has a fairly simple solution. There's a terminal command I need to run when a server I've configured (a Mac one, of course) starts up. After some googling, I established that I needed to make a plain text file with the terminal command(s) in, rename it as mychosenfilename.command, and add it to the logged-in user's startup items.

So far so good, except the command in question is a sudo command, requiring that I type it in my password each time, making it more of an assisted startup item. Anyone know how I can, I guess, pre-approve this command to run without my intervention?
 
Doing that is not very secure, but if you really want to find out, I think this page might help you. I can't tell for sure, because I have no reason for sudo to run without a password. Just to be clear though,
Code:
sudo -s
will switch the user to the root user, which is even less safe than using sudo.
 
Add your commands to the end of /etc/rc instead of using StartupItems.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.