Running login functions as root

Hello!

I’m new to this board. I’ve been looking all over the internet for an answer to this question, and I’m beginning to lose hope that it’s possible at all. Anyhow;

I’m trying to set up fvwm to run synergy (to share a mouse and keyboard from another machine) when a session starts. I’m using a session manager, so I tried to add the required code to the SessionInitFunction by adding the following lines to ~/.fvwm/.fvwm2rc:

[code]AddToFunc SessionInitFunction

  • I Exec sudo /usr/bin/synergyc B36146[/code]

Where B36146 is the name of the machine serving the mouse and keyboard. This did nothing. When I remove the sudo, it works fine, but without sudo the cursor is really choppy (some bug with ubuntu 8.04, apparently). Is there any way to run something as root on login to fvwm?

Thanks for any help

Andy

edit: misunderstood what “Code” would look like…

The only reason this couldn’t work is if you haven’t setup sudo to accept no passwords for the user that above code runs as. As an example (you would use the ‘visudo’ command to add the following):

%sudoers ALL=NOPASSWD: ALL

This is a group policy – whereby all members of the “sudoers” group can run any command. To make it per user, and to restrict what can run:

myusername ALL=NOPASSWD: /path/to/someprog, /path/to/someotherprog

To get back to FVWM though, are you sure starting this up within your FVWM-config is the best option? I don’t. Especially not in the Session Manager functions. No, add it to ~/.xsession instead.

– Thomas Adam

Thanks very much. I added the line to sudoers, just for the one function, though. Then added the appropriate lines to .xsession and bam! Mouse and keyboard sharing works. Thanks Thomas.