# emerge with proxies

## eponymous

Hi,

I have to go through a proxy server when I do an emerge and it requires a username and password.

I was just wondering if there was a secure way to store the username and password rather than sticking it in a plain text string in the /etc/make.conf file?

I.e. a better way than:

/etc/make.conf

```
http_proxy="http://username:password@yourproxybox.org:portnumber"

ftp_proxy="ftp://username:password@yourproxybox.org:portnumber"

RSYNC_PROXY="rsync://username:password@yourproxybox.server:portnumber"
```

Cheers.

----------

## Hu

You could export it into the environment from which emerge is run.  Is there a reason you cannot store the proxy data in /etc/make.conf?

----------

## eponymous

It would mean storing the password in plaintext in that file.

This is fine if the file is owned and only readable/writable (600) by root but I'm not sure if you can do that.

----------

## Veldrin

alternatively you could use 640 with root:portage.

there not many users part of the portage group.

(though it still needs to be tested)

----------

## Hu

If that is the only concern, another option would be to have a shell function or wrapper script that root runs which would export the proper data into its environment, then exec the real emerge.  For example:

```
#!/bin/sh

. ~/.http-proxy-credentials.sh

exec /usr/bin/emerge "$@"
```

```
export http_proxy="http://username:password@yourproxybox.org:portnumber"
```

Then just ensure that /root/bin is higher in root's $PATH than /usr/bin.

----------

## eponymous

Good idea, thanks  :Smile: 

----------

