LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 02-27-2007, 07:42 AM   #1
djsodom
LQ Newbie
 
Registered: Feb 2007
Posts: 1

Rep: Reputation: 0
A visudo script?


I'm writing an automatic deployment script to set up a fedora server. As part of this, I'd like to be able to script adding new users and permissions to the sudoers file. For example, I'd like to automatically paste in 'myusername ALL = ALL to the bottom of /etc/sudoers. Ideally it would use visudo to prevent any errors.

Any suggestions?

Thanks,

Steve
 
Old 02-27-2007, 07:53 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
You can (backup and then) write* to it since it's just text/plain.
After writing execute "visudo -s -c -f /etc/sudoers" and check the exit status.

* I mean visudo uses the VISUAL or EDITOR envvar, so yeah, you can probably set it to "vi" and make it execute a script, but what's the added value of doing that?..

Last edited by unSpawn; 02-27-2007 at 08:04 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
dont see visudo matrix13 Linux - General 1 02-27-2007 01:40 AM
visudo noonmid27 Linux - Newbie 8 02-23-2007 04:42 PM
visudo and pico crud Slackware 3 03-16-2005 04:51 AM
Need help with visudo powadha Debian 2 12-19-2004 05:04 AM
visudo xviddivxoggmp3 Slackware 7 08-17-2004 08:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:57 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration