!nkubus Posted September 8, 2004 Report Share Posted September 8, 2004 i have a script that is running root (usb-storage script) i know that everything is mounted on mandrake but i'm trying to output a message to the user of course WITHOUT ROOT privileges (to reduce the possibility of having a user to run process a root) and to have the same config and skin than the current user here my exemple: i'm on kde 3.3 script thing .... dropping root privilege to current user ./kdialog --title "New Usb-Storage found" --passivepopup \ "is avaible in /mnt" 10 i know i'm not clear but any idea will help me a lot Quote Link to comment Share on other sites More sharing options...
b Posted September 8, 2004 Report Share Posted September 8, 2004 Hi Some way ... #build kdialog command file echo "#!/bin/sh" > /tmp/kdialog_cmd echo "/usr/kde/3.3/bin/kdialog --title test --msgbox test &" >> /tmp/kdialog_cmd chmod a+x /tmp/kdialog_cmd # run kdialog command file as some-user su - some-user -c /tmp/kdialog_cmd ... hih Quote Link to comment Share on other sites More sharing options...
!nkubus Posted September 8, 2004 Author Report Share Posted September 8, 2004 it seems to work thank you ,but my root is not able to connect o X server so i cannot see the dialog box thanks for your help :) Quote Link to comment Share on other sites More sharing options...
b Posted September 9, 2004 Report Share Posted September 9, 2004 Hi "but my root is not able to connect o X server" Good. In X while root is risky/happy-sitting-duck! Don't do this!! (cut off www if unprotected &| paranoid) (then give root X permision) cp /home/$USER/.Xauthority /root as root check root $DISPLAY value (should be same as echo $USER when $USER) "so i cannot see the dialog box" Doe's this work? Alt/F2 kdialog --title test --msgbox test 0 problems here. I thought the idea was to run kdialog with non root priviledges! My little script work's here. (Maybe try it stanalone say as test.sh first) Please post your shell script. Maybe somebody will pick up something? Quote Link to comment Share on other sites More sharing options...
!nkubus Posted September 10, 2004 Author Report Share Posted September 10, 2004 Hi "but my root is not able to connect o X server" Good. In X while root is risky/happy-sitting-duck! Don't do this!! (cut off www if unprotected &| paranoid) (then give root X permision) cp /home/$USER/.Xauthority /root as root check root $DISPLAY value (should be same as echo $USER when $USER) "so i cannot see the dialog box" Doe's this work? Alt/F2 kdialog --title test --msgbox test 0 problems here. I thought the idea was to run kdialog with non root priviledges! My little script work's here. (Maybe try it stanalone say as test.sh first) Please post your shell script. Maybe somebody will pick up something? <{POST_SNAPBACK}> ok here is my output : root@timon:/tmp# ./test.sh Xlib: connection to ":0.0" refused by server Xlib: No protocol specified xhost: unable to open display ":0.0" kwrite: cannot connect to X server and here is the content of my file: cat test.sh #build kdialog command file export DISPLAY=":0.0" echo "#!/bin/sh" > /tmp/kdialog_cmd xhost + echo "kwrite" >> /tmp/kdialog_cmd chmod a+x /tmp/kdialog_cmd # run kdialog command file as some-user su - frank -c /tmp/kdialog_cmd and yer alt f2 give me the dialog ;) thanks again for your help :) Quote Link to comment Share on other sites More sharing options...
!nkubus Posted September 10, 2004 Author Report Share Posted September 10, 2004 and if i set comment the xhost and the export display it still says: ./test.sh kwrite: cannot connect to X server and the file is this #build kdialog command file #export DISPLAY=":0.0" echo "#!/bin/sh" > /tmp/kdialog_cmd #xhost + echo "kwrite" >> /tmp/kdialog_cmd chmod a+x /tmp/kdialog_cmd # run kdialog command file as some-user su - frank -c /tmp/kdialog_cmd Quote Link to comment Share on other sites More sharing options...
!nkubus Posted September 10, 2004 Author Report Share Posted September 10, 2004 i GOT IT i have changedyour last line su - frank -c /tmp/kdialog_cmd to su frank -c /tmp/kdialog_cmd because the dash in su remove all variables exported so this is why :) thank you for your help , now i only have to know wich user have cause my deamon to start :) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.