<p>Is there any way so that i can echo password when asked for in unix shell without use of external binaries ? Something like simple function triggered when password prompt is displayed</p>

```
```
import socket
socket.gethostbyname(socket.gethostname())
```
```
This won't work always (returns
```
127.0.0.1
```
on machines having the hostname in
```
/etc/hosts
```
as
```
127.0.0.1
```
), a paliative would be what gimel shows, use
```
socket.getfqdn()
```
instead. Of course your machine needs a resolvable hostname.