Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

At our computer department we need to run a script with user rights wenn the user logs in. Adding the script to .config/autostart is not an option since the script must not be disabled by the user.

The Problem with for example the session-setup-script directive in lightdm.conf is that the script is run by root. We would therefore need to determine what users is currently trying to login and su to that user. That seems tricky since multiple users could already be logged in on the very same machine.

Is there a proper to way to do this?

Thanks in advance

share|improve this question
add comment

1 Answer

There may be a neater way to do this in lightdm, but it should presumably be possible to edit the session files in /usr/share/xsessions. Replace the Exec line, eg Exec=gnome-session --session=ubuntu with the path to a wrapper script which calls your scripts and then starts the session.

This should be executed in the user's context and not be disableable.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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