1

I am trying to run i3lock which relies on the USER variable for the password to unlock the computer. I am running this on Fedora 24.

I need this to be in a shell script because it is being executed by acpid.

#!/bin/sh
export USER=myusername
i3lock

But the USER variable is still set to the root. How can I set this environment variable from the shell script?

2

1 Answer 1

3

If we look at the source for (a version of) i3lock, we can see it determines the user whose password is required by doing getuid(). So setting the environment variable USER has no effect, and you will need to su or sudo as that user instead.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .