Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old June 26th, 2000, 07:55 AM
pcheng pcheng is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 3 pcheng User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I have a form where a user enters values to create a user on a server. I need to be able to execute the Useradd command but I can't. Is there a way of logging in the server using CGI and then executing the command?

Thank you ,

Pericles Cheng

Reply With Quote
  #2  
Old June 26th, 2000, 10:37 AM
kudinov kudinov is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 19 kudinov User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Defining of cgi_user for priveleged user will be a hole in security of your net.
You can write UNIX-shell or perl script with required procedures that will read thru a 'loop' some directory. This script could be run by priveleged user.

<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by pcheng:
I have a form where a user enters values to create a user on a server. I need to be able to execute the Useradd command but I can't. Is there a way of logging in the server using CGI and then executing the command?

Thank you ,

Pericles Cheng
[/quote]


Reply With Quote
  #3  
Old June 27th, 2000, 01:06 AM
pcheng pcheng is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 3 pcheng User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Is there a way that a user could log in the server using a username and password (something like telnet, but through cgi)? That way the user must know the username and password to access the files needed by the program. I found something that might be of help but I am not sure how to implement it. That is the SETUID command but it takes a lot of configuring.

Reply With Quote
  #4  
Old June 27th, 2000, 01:49 AM
dwarf dwarf is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 300 dwarf User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
Well, as far as my UNIX knowledge goes, setuid is the only thing you can do to make this work. Reading a man page for the command should get you on the right track.

Reply With Quote
  #5  
Old June 27th, 2000, 02:09 AM
freebsd
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
>>Is there a way of logging in the server using CGI and
>>then executing the command?

Yes, run Apache as 'root', which is not a wise thing to do.

>>That is the SETUID command but it takes a lot of configuring.

setuid or cgiwrap doesn't enable your users to run ANY system commands.

>>something like telnet, but through cgi
Yes, download-> http://www.perl.com/CPAN-local/modules/by-module/Net/Net-Telnet-3.02.tar.gz
Read->http://www.perl.com/CPAN-local/modules/by-module/Net/Net-Telnet-3.02.readme

Pericles, Even you trust those users, what you are trying to do is opening your server for potential attacks.

[This message has been edited by freebsd (edited June 27, 2000).]

Reply With Quote
  #6  
Old June 27th, 2000, 11:10 AM
vpopper's Avatar
vpopper vpopper is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Location: Southern California
Posts: 73 vpopper User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 24 sec
Reputation Power: 9
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by pcheng:
I have a form where a user enters values to create a user on a server. I need to be able to execute the Useradd command but I can't[/quote]

You should split this process into two actions. Have your CGI form handler insert the info into a DBM file or SQL database, then write a cron job that runs every five minutes, running as root, put the database info into the system using 'pw' or the equivalent on your system.


Reply With Quote
  #7  
Old June 28th, 2000, 01:29 AM
pcheng pcheng is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 3 pcheng User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thank you all for your help. I finally made it by using the Net::Telnet module and telneting to the machine. This gave me the option of logging in as super user and performing the tasks I needed.

Once again thank you for all your help.

Reply With Quote
  #8  
Old June 28th, 2000, 02:17 PM
kudinov kudinov is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 19 kudinov User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
It isn't a good idea to store not encrypted password for root in general and in the public catalog especially.
And another thing is that you will need to change text of your programm when you assign a new password for root.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > Executing root commands


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway