Ubuntu

~/.pam_environment and variable values with spaces

Asked by Andrey Bondarenko on 2011-05-28

I'm trying to define a variable in ~/.pam_environment. A value of the variable should contain a space. I've found rather strange behaviour:

Add into ~/.pam_environment following lines:

MYVAR0=some_variable
MYVAR1=some variable
MYVAR2='some variable'
MYVAR3="some variable"
MYVAR4=some\ variable

Open a new login session on a vt and check environment:

$ env | grep MYVAR
MYVAR0=some_variable

As you can see, out of 5 variables MYVAR[0-4] only the first one was defined. I cannot find description of .pam_environment syntax neither in pam_env nor pam_enf.conf manpages. May be I missed something. For me looks like a bug.

I'm using pam_env.so installeb by libpam-modules version 1.1.2-2ubuntu8 from Kubuntu Natty.

Question information

Language:
English Edit question
Status:
Open
For:
Ubuntu pam Edit question
Assignee:
No assignee Edit question
Last query:
2011-06-06
Last reply:
Andrey Bondarenko (abone) said : #1

Found the cause. As of version pam-1.1.2-3ubuntu8.2 user_envfile is read as conffile which has different syntax.

modules/pam_env/pam_env.c:796
        retval = _parse_config_file(pamh, envpath);

Very misleading because pam_env manpage states:

       /etc/environment
           Default environment file

       $HOME/.pam_environment
           User specific environment file

This sounds for me like /etc/environment and ~/.pam_environment should have the same syntax, but in fact they don't. Still can't decide if it is documentation or implementation bug.

Can you help with this problem?

Provide an answer of your own, or ask Andrey Bondarenko for more information if necessary.

To post a message you must log in.