View previous topic :: View next topic |
Author |
Message |
d0minus Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
![](images/avatars/195545056142cbc2df95928.gif)
Joined: 25 Apr 2005 Posts: 90 Location: Ukraine
|
Posted: Fri Mar 03, 2006 10:55 am Post subject: run script with root permision |
|
|
on boot my system run script with root permision but only once
after that it run with user permision. How I can run this script from root?
Code: |
#!/bin/bash
while (sleep 5)
do
RESULT3=`ps ax|grep new|grep print`;
if [ "$RESULT3" == "" ]
then
cp /home/user/.Xauthority /root/.Xauthority
su -c "DISPLAY=:0 /usr/share/print/new_print > /dev/null &" user;
fi
done
|
I think su must read root password from file. But how to do this? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
chrism Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 15 Jul 2004 Posts: 526
|
Posted: Fri Mar 03, 2006 11:02 am Post subject: |
|
|
su -c "what ever you what to execute"
make shure your user is in the wheel group.
Chris |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
d0minus Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
![](images/avatars/195545056142cbc2df95928.gif)
Joined: 25 Apr 2005 Posts: 90 Location: Ukraine
|
Posted: Fri Mar 03, 2006 11:17 am Post subject: |
|
|
su -c "what ever you what to execute" in such case it ask a root password
user is in wheel group |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
JeliJami Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
![](images/avatars/148526789243d7753a09b11.jpg)
Joined: 17 Jan 2006 Posts: 1086 Location: Belgium
|
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
d0minus Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
![](images/avatars/195545056142cbc2df95928.gif)
Joined: 25 Apr 2005 Posts: 90 Location: Ukraine
|
Posted: Fri Mar 03, 2006 12:30 pm Post subject: |
|
|
davjel
you are wright but I cannot execute it from bash
for example
Code: | sudo "DISPLAY=:0 xcalc"
sudo: DISPLAY=:0 xcalc: command not found |
what I does wrong? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
JeliJami Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
![](images/avatars/148526789243d7753a09b11.jpg)
Joined: 17 Jan 2006 Posts: 1086 Location: Belgium
|
Posted: Fri Mar 03, 2006 12:38 pm Post subject: |
|
|
if you have env_keep=DISPLAY on for your sudo user you can just start xcalc:
from within an xterm _________________ Unanswered Post Initiative | Search | FAQ
Former username: davjel |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
d0minus Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
![](images/avatars/195545056142cbc2df95928.gif)
Joined: 25 Apr 2005 Posts: 90 Location: Ukraine
|
Posted: Fri Mar 03, 2006 1:38 pm Post subject: |
|
|
plz write more detail how to set env_keep=DISPLAY
tnx |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
JeliJami Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
![](images/avatars/148526789243d7753a09b11.jpg)
Joined: 17 Jan 2006 Posts: 1086 Location: Belgium
|
Posted: Fri Mar 03, 2006 4:36 pm Post subject: |
|
|
this is part of my sudoers file (edit with visudo!):
Code: | # Allow users in group users to export specific variables
Defaults:%users env_keep=DISPLAY
|
_________________ Unanswered Post Initiative | Search | FAQ
Former username: davjel |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|