You are here: Re: [PHP] question about system function call « PHP « IT news, forums, messages
Re: [PHP] question about system function call

Posted by "Richard Lynch" on 06/17/05 03:26

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 //user@host")
>
> 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 //user@host

If not, you MIGHT be able to do:

system("echo SECRET\n | /usr/bin/smbutil -v view //user@host");

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 //user@host");

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация