On Thu, June 16, 2005 2:43 pm, Tom Cruickshank said: > I'm trying to do the following in php. > > system("/usr/bin/smbutil -v view //[EMAIL PROTECTED]") > > to be able to view some shares folders on a server. > > Unfortunately, if I use this command in console, I get prompted for a > password. > > Is there a way in php to wait for a password and enter it automatically? > > Please let me know. Thanks!
smbutil may or may not accept a password as an argument. Something like: smbutil --password=SECRET -v view //[EMAIL PROTECTED] If not, you MIGHT be able to do: system("echo SECRET\n | /usr/bin/smbutil -v view //[EMAIL PROTECTED]"); You may need to dink around with the \n part to get it into the shell rather than in the PHP string... system("echo -e \"SECRET\\n\" | /usr/bin/smbutil -v view //[EMAIL PROTECTED]"); You should use exec instead during experimentation at least, so you can get error messages... Actually, exec is probably better all around, unless you really need passthru for performance reasons... smbutil *might* require a TTY (a REAL logged in person) the way some programs do. If its documenation says so, I think you're out of luck on the password bit. There might be other options, like SSH key-pair authentication or Kereberos or, for all I know, somebody wrote a PHP Samba Module while I wasn't looking... I'd probably never use it, so wouldn't have noticed. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php