Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I already know about faketime and datefudge, but is there a way to set this up transparently for any process that's being run as a certain user (identified by a specific UID)?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Since you have the entire source code to Linux, you can set this up exactly as you want, but you'll have to modify the system kernel and rebuild it to make it so. It isn't easy to set this up based on a UID.

If you only want to arrange that a logged in user has this property for most commands they execute, give them a login shell that uses faketime to set the environment variable and then call their real shell. You can get a taste for how this looks by doing it interactively:

$ date
Mon Oct 14 14:02:05 EDT 2013
$ faketime yesterday bash
$ date
Sun Oct 13 14:02:10 EDT 2013
$ exit
$ date
Mon Oct 14 14:02:15 EDT 2013

A special login shell should also work for cron jobs that use the user's login shell.

Of course this fakery fails for any program that sets or ignores its own $LD_PRELOAD information:

$ faketime yesterday bash
$ date
Sun Oct 13 14:02:20 EDT 2013
$ env -i /bin/date
Mon Oct 14 14:02:25 EDT 2013
share|improve this answer

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.