LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-29-2003, 03:06 PM   #1
NetFlash
LQ Newbie
 
Registered: Oct 2003
Posts: 2

Rep: Reputation: 0
Arrow Bash script to edit passwd without Root password?


Here's the deal guys....

I have to write a bash script that will allow a user to create a new account.
So that includes adding a new line to the passwd file, creating his home dir, setting permissions for his home dir and adding his password to the shadow file.

The problem is that for adding a new line to the passwd file, shadow file, and setting permissions you have to have root acces. I tried using sudo in the script but I soon realized that the user has to be in the sudoers file. So an unknown usr can't use this script.

Is there any way I can rewrite this script so any user can use it..???
Can't I make this script run in a root shell...??...And if so...How do I do it..??

Thx for your cooperation

 
Old 11-29-2003, 03:19 PM   #2
linksocc
Member
 
Registered: Jul 2003
Location: US
Distribution: Mandrake 9.0 1st/9.1 2nd/Gentoo 1.4 now
Posts: 313

Rep: Reputation: 30
use sudo and give everybody in the "users" group permission to run it as root, like this in you /etc/sudoers file
Code:
%users localhost = NOPASSWD: /path/to/script
 
Old 11-29-2003, 05:22 PM   #3
NetFlash
LQ Newbie
 
Registered: Oct 2003
Posts: 2

Original Poster
Rep: Reputation: 0
Hmm....That will only work on 1 machine.

Thx......That's is indeed a really good solution, but then I won't be able to run the script on other machines couse I only change the sudoers on my machine.

IT will provide a temporary solution though.

If you or anyone else knows another solution......pls post it.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Root Password Script? wellington Linux - Software 5 05-30-2006 01:21 AM
bash script that uses username/password paul_mat Linux - Software 2 10-25-2005 11:44 PM
ow to create script change a user's password? passwd expects input from keyboard.. Arodef Linux - General 1 03-02-2005 11:40 PM
accepting root passwd from UI and passing it to a shell script to extract a rpm rameshvl Linux - Software 4 03-18-2003 01:11 AM
bash script for passwd mystykmax Programming 2 02-20-2003 01:33 AM


All times are GMT -5. The time now is 06:24 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration