Prev: How do I restore with Time Machine?
Next: The Apple Two The iPad is Steve Jobs' final victory over the company's co-founder Steve Wozniak.
From: laredotornado on 26 Apr 2010 12:37 Hi, I'm using Mac 10.6.3. I'm a sudo user. On my machine, I frequently need to restart my Apache web server, and hwen I pop open my terminal and type > sudo /usr/sbin/apachectl restart I'm prompted for a password immediately after. Is there a way I can avoid having to type my password and just enter the command above? Thanks, - Dave
From: JF Mezei on 26 Apr 2010 12:52 laredotornado wrote: > I'm prompted for a password immediately after. Is there a way I can > avoid having to type my password and just enter the command above? sudo bash you enter the poassword once, and then you have a subprocess which is always in sudo mode. Or you can enable the "root" account <ducking because I know the comments that will be made> and you can then login in as "root" and not need to use sudo.
From: johnny bobby bee on 26 Apr 2010 13:57 On 04/26/2010 12:37 PM, laredotornado wrote: > I'm prompted for a password immediately after. Is there a way I can > avoid having to type my password and just enter the command above? sudo su You'll need to enter the password once. Then enter all the commands to your heart's content. Exit when finished. -- Nothing exists except atoms and empty space; everything else is opinion. -- Democritus
From: Jolly Roger on 26 Apr 2010 14:28 In article <28ac1987-ba86-4ce3-b562-3981cae0ff7a(a)h16g2000prf.googlegroups.com>, laredotornado <laredotornado(a)zipmail.com> wrote: > Hi, > > I'm using Mac 10.6.3. I'm a sudo user. On my machine, I frequently > need to restart my Apache web server, and hwen I pop open my terminal > and type > > > sudo /usr/sbin/apachectl restart > > I'm prompted for a password immediately after. Is there a way I can > avoid having to type my password and just enter the command above? > > Thanks, - Dave The most secure way to do this is by editing the /etc/sudoers file to contain an entry that allows NOPASSWD access for particular commands. For instance, if you wanted to allow NOPASSWD access for the user named dave to the apachectl command, you would add entries similar to this: Cmnd_Alias APACHECTL = /usr/sbin/apachectl dave ALL = NOPASSWD:APACHECTL For more information, read the sudo and sudoers manual pages. -- Send responses to the relevant news group rather than email to me. E-mail sent to this address may be devoured by my very hungry SPAM filter. Due to Google's refusal to prevent spammers from posting messages through their servers, I often ignore posts from Google Groups. Use a real news client if you want me to see your posts. JR
From: Jolly Roger on 26 Apr 2010 14:30
In article <4bd5c4b0$0$9587$c3e8da3(a)news.astraweb.com>, JF Mezei <jfmezei.spamnot(a)vaxination.ca> wrote: > laredotornado wrote: > > > I'm prompted for a password immediately after. Is there a way I can > > avoid having to type my password and just enter the command above? > > sudo bash > > you enter the poassword once, and then you have a subprocess which is > always in sudo mode. The drawback to doing this is that it's an extra step you have to take each occasion you want to run commands as root/admin. A better alternative is to add an appropriate entry in /etc/sudoers (as I have described in another reply) that allows you to run that command without a password prompt as the particular user account you use daily. This saves you that extra step of switching to the root/admin account each occasion. > Or you can enable the "root" account <ducking because I know the > comments that will be made> and you can then login in as "root" and not > need to use sudo. Overkill. 'Nuff said. -- Send responses to the relevant news group rather than email to me. E-mail sent to this address may be devoured by my very hungry SPAM filter. Due to Google's refusal to prevent spammers from posting messages through their servers, I often ignore posts from Google Groups. Use a real news client if you want me to see your posts. JR |