0

I'm trying to create mozilla profile for another user from command line using su.

When I'm trying from X, this will work.

su myuser -c 'mozilla -CreateProfile newprofile'

But my goal is to embed this to a script and it will execute only in command line mode. If I try this, from a command line, It also works:

DISPLAY=1.0 mozilla -CreateProfile newprofile

The question is how to embed "DISPLAY" variable in "su" command, cause this fails:

su myuser -c 'DISPLAY=1.0 mozilla -CreateProfile newprofile'
  • Why is "linux" in the title if you say you are running SCO Unix? – user1686 Sep 8 '10 at 21:09
1

Have you tried this:

su myuser -c 'export DISPLAY=\"1.0\"; mozilla -CreateProfile newprofile'

This should really be posted on superuser.com

Try that variant by escaping the quotes in the variable DISPLAY...

  • Yes, I've tryed it. It fails too. – Anonymous Sep 8 '10 at 12:38
0

This works for me:

su sh -c 'DISPLAY=1.0  echo $DISPLAY'

what exactly is the error you are getting?

  • Unfortunately, this doesn't work for me. Maybe becouse of my OS - SCO Unix. Errors are only some perl warnings from 'locale', but I've got them also in X mode, so this is not the reason. Mozilla comand finishes, but without creating the profile. – user48777 Sep 8 '10 at 12:45
  • 1
    SCO Unix? Respect. – Janne Pikkarainen Sep 8 '10 at 12:49
0

What about this one:

su myuser -c "sh -c 'DISPLAY=1.0 mozilla -CreateProfile newprofile'"
  • No it fails too. – user48777 Sep 8 '10 at 14:15
  • And what does complain? – cYrus Sep 8 '10 at 14:17
  • It does not complain. it finishes cleanly, but profile directory is not created. Never mind, I solved the problem. Thanks for reply. – user48777 Sep 8 '10 at 14:45
0

Solved:

su - -c 'DISPLAY=1.0 mozilla -CreateProfile newprofile' myuser
0
TEMPXAUTH=$(xauth nlist) su -c 'xauth nmerge <<< "$TEMPXAUTH" && mozilla -CreateProfile newprofile'

A temporary file would work too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.