Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So, here's what I'd really love to do. My Arch Linux laptop is put to sleep with the help of pm-utils, some X apps (transmission, banshee, etc.) need to be manually shutdown (via script in /etc/pm/sleep.d/ and restarted on sleep resume. However, as pm hooks are run as root user running a X app for normal user AS root is quite a challenge. It all comes down to having DISPLAY and XAuthority exported, I know, but I've ran out of ideas how to make it work, and I've tried a number of approaches but none of them ever worked.

So, I decided to throw this out and see if any of the superusers here know what can be done about this :)

share|improve this question
You shouldn't have to shut down any programs - they get suspended along with the rest of the system. Transmission does not need any special treatment, it will gradually resume transfers on wake. – grawity Nov 21 '11 at 12:54
If I put a laptop into sleep and transmission actively even reads data, or banshee for that matter, upon resume something weird happens. Best illustration is the following. If I'm on console in /media/disk/tmp directory and send laptop to sleep, when resumed running ls in that dir will fail to produce output. Even though disk is mounted in the same location. Leaving the path with cd and returning back to it "fixes" the issue. I believe other apps hang the laptop for the same reason. So I have to kill them off prior to switching to sleep mode. – ILIV Dec 5 '11 at 16:42

In answer to the question itself, you want to set the file to SUID root. As commented by grawity, there shouldn't be any necessity to having to shut these programs down though for when it goes to sleep.

share|improve this answer
True, but something weird happens when I do. Read my comment above, please. I don't think SUID is a great idea. Isn't there a less risky way of doing this? – ILIV Dec 5 '11 at 16:45
up vote 0 down vote accepted

Long story short, this is the 'how'

root@host$ sudo -u joe DISPLAY=:0 transmission-gtk

At the time when I asked this question I was apparently running a kernel with a nasty bug as a bonus, because a lot of weird things were going on when I resumed laptop from sleep.

Right now, I run another kernel version and none of the described above problems exist. And I sudo now just works. I've tried all sorts of things, you name it. Nothing worked, and I'm not exactly new to Linux shrug.

It does work now. Thanks for all the help!

share|improve this answer

You must log in to answer this question.

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