LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-03-2005, 12:36 AM   #1
phoenix_fei
Member
 
Registered: Nov 2004
Location: shanghai
Distribution: worket
Posts: 41

Rep: Reputation: 15
Arrow how to invoke passwd


hello:
i know i will invoke "system(ls)" and list all file information.
and i not know how to invoke "system(passwd)"?who may explian it to me?

how to slove it ?
 
Old 06-03-2005, 12:50 AM   #2
hk_linux
Member
 
Registered: Nov 2004
Location: India
Distribution: RedHat, PCQLinux, Fedora
Posts: 95

Rep: Reputation: 15
first of all, system command doesnt work with interactive commands like passwd.
System executes a command by calling "/bin/sh". So when you call
system (passwd), a new shell is created and "passwd" command is called. It is now
waiting for the inputs of old and new passwords. The calling program will hang.

Use Expect scripts, may be for these tasks.

Any how, programatically setting a password is not a good option.
 
Old 06-03-2005, 02:44 AM   #3
alred
Member
 
Registered: Mar 2005
Location: singapore
Distribution: puppy and Ubuntu and ... erh ... redhat(sort of) :( ... + the venerable bsd and solaris ^_^
Posts: 658
Blog Entries: 8

Rep: Reputation: 31
if you really need to call sys() , you may try this :

Code:
system("xterm +hold -e 'passwd'");
but this will gives you an xterm ...
this works on my linux though
 
  


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
vim invoke noir911 Programming 1 01-29-2005 07:15 PM
invoke xterm through program sudha naidu Programming 2 12-27-2004 03:46 AM
invoke makefile: make invasian Linux - Newbie 2 08-08-2004 01:52 AM
Want to invoke debugger through JSP. kirti Programming 0 06-11-2004 02:30 AM
How to invoke FTP from Korn shell WindozBytes Programming 6 09-07-2002 08:53 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:49 PM.

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