Red Hat This forum is for the discussion of Red Hat Linux. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
03-06-2005, 10:39 AM
|
#1
|
LQ Newbie
Registered: Mar 2005
Posts: 28
Rep:
|
How to run a Script as root, after Login as User, in GDM
Well, the topic says everything:
How can I run a Script as `root` _after_ I Login into GDM using a simple User-account?
gnome-session-properties will only start Scripts as the User I logged in.
If I add the Scripts into `/etc/X11/gdm/PreSession/Default`, the Scripts will be executed as root - all right - but somehow they are executed during the Loading-Screen for the user - and this messes up the GUI for the Programs (don't ask me why though), which are `daemon`ed through the Scripts...
So what exactly do I have to do?
I'm using RedHat 9.0 and GDM.
Thanks & bye bye~,
MHOOO
|
|
|
03-06-2005, 12:05 PM
|
#2
|
Moderator
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047
Rep:
|
Welcome to LQ.
Just open up a terminal and type "su -", press return and enter the root password. You should now be able to type any commands as root.
|
|
|
03-06-2005, 12:33 PM
|
#3
|
LQ Newbie
Registered: Mar 2005
Posts: 28
Original Poster
Rep:
|
Hi - and thanks for the warm welcome ;!D
Uhm~ ..., about the problem:
I know how to run Scripts as root from the Terminal - thats not the real difficulty - but I want `GDM` to run a Script as `root`, _after_ somebody has Logged in using the Visual Login.
In the end, I want something like an "autostart"-file for GDM.
Something like `/etc/init.d/` or `/etc/rc.d/rc.local` - only, that it has to be executed _after_ a User logs in (and thus, the GUI (GDM) is Loaded) _and_ the Script has to be executed with User `root`.
This way I could start Scripts/Programs, which require a running GDM instance/server (call it whatever you want - I hope you know what I mean x!D).
I'm really sorry if my first post wasn't clear enough!
Thanks & bye bye~,
MHOOO
|
|
|
03-06-2005, 12:43 PM
|
#4
|
Moderator
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047
Rep:
|
If you want an ordinary user to run it then you could set it suid root with "chmod +s /path/to/script.sh". Most window managers then have a way to autostart applications.
|
|
|
03-06-2005, 01:07 PM
|
#5
|
LQ Newbie
Registered: Mar 2005
Posts: 28
Original Poster
Rep:
|
No, thats not it, I just have a Program which has it's config-files in `/root/.MyProg/` - the problem is, whenever a new User starts this Program, a new Directory (for config-files) will be created at `/home/$USER/.myProg/` - and this is exactly what I don't want.
Thats why I want GDM to run a Script, which first sets the appropiate $USER,$HOME,$PWD,... - Vars for `root` and then runs the actual Program - the Program will think the logged in User is `root` and thus will get the config-files from the `/root/.MyProg/` dir.
_But_, if the Script isn't run as `root`, then the Program can't be run as root - and thus it wouldn't have the access rights to the `/root/.MyProg/` dir.
So thats exactly where my Problem is x!D
Thanks & bye bye~,
MHOOO
|
|
|
03-06-2005, 01:11 PM
|
#6
|
Moderator
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047
Rep:
|
I have to say that that sounds really insecure, I hope you are really confident about the way that program is coded. Either way I can't see why using a setuid script wouldn't work but maybe I'm missing something.
|
|
|
03-06-2005, 02:12 PM
|
#7
|
LQ Newbie
Registered: Mar 2005
Posts: 28
Original Poster
Rep:
|
Hmm, I agree, this really is somehow insecure - but how else, can I give the program access to the `/root/.MyProg/` dir?
I tried changing the owner to `root:mygroup` (where `mygroup` is the group of the User I'm logging in with) and setting the rights to `0770`, but the Script (started through the User which is in `mygroup`) still wouldn't have access to the directory (`/root/.myprog/`).
I tried `chmod +s MyStartScript` as well, but it doesn't seem to work (what exactly does the `s` option? The man-page just says something about guid/suid being set, what exactly does this mean?).
What exactly is this "setuid script" you are refering to?
Thanks for the answers! & bye bye~,
MHOOO
|
|
|
03-06-2005, 02:19 PM
|
#8
|
Moderator
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047
Rep:
|
Is there a reason you need to use the /root/.Yourprog path as opposed to ~/.Yourprog?
|
|
|
03-06-2005, 02:42 PM
|
#9
|
LQ Newbie
Registered: Mar 2005
Posts: 28
Original Poster
Rep:
|
Well, I'm pretty new to linux... and thus I've set up the `/root` folder to ~50GB, while I've only got ~10 for the /home folder...
Since I've got 3 Programs, which are using ~10-15 GB space each, I won't be able to use them with any folder except the `/root` one.
Thanks & bye bye~,
MHOOO
|
|
|
03-06-2005, 02:45 PM
|
#10
|
Moderator
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047
Rep:
|
Why not just swap the partition layout a little bit?
If you want to then post the output from:
fdisk -l
df -h
|
|
|
03-06-2005, 02:55 PM
|
#11
|
LQ Newbie
Registered: Mar 2005
Posts: 28
Original Poster
Rep:
|
I'm sorry, I'm using the german version, I hope you will understand it:
`fdisk -l`
Code:
Platte /dev/hde: 80.0 GByte, 80026361856 Byte
255 Köpfe, 63 Sektoren/Spuren, 9729 Zylinder
Einheiten = Zylinder von 16065 * 512 = 8225280 Bytes
Gerät boot. Anfang Ende Blöcke Id Dateisystemtyp
/dev/hde1 * 1 13 104391 83 Linux
/dev/hde2 14 1925 15358140 83 Linux
/dev/hde3 1926 3200 10241437+ 83 Linux
/dev/hde4 3201 9729 52444192+ f Win95 Erw. (LBA)
/dev/hde5 3201 3454 2040223+ 82 Linux Swap
/dev/hde6 3455 3556 819283+ 83 Linux
/dev/hde7 3557 9665 49070511 83 Linux
/dev/hde8 9666 9729 514048+ 83 Linux
`df -h`
Code:
Dateisystem GröÃe Benut Verf Ben% Eingehängt auf
/dev/hde7 47G 20G 25G 45% /
/dev/hde1 99M 14M 80M 15% /boot
/dev/hde3 9.7G 58M 9.1G 1% /home
none 504M 0 504M 0% /dev/shm
/dev/hde8 487M 8.6M 453M 2% /tmp
/dev/hde2 15G 1.9G 12G 14% /usr
/dev/hde6 788M 103M 645M 14% /var
Thanks & bye bye~,
MHOOO
|
|
|
03-07-2005, 10:39 AM
|
#12
|
LQ Newbie
Registered: Sep 2003
Location: Singapore
Posts: 23
Rep:
|
if i not mistaken, suid on script is ignore by linux. i think if u just want to utilised the space in / then create directories at / & chown to the user xyz,then create a symlink /home/xyz/.myprog that link to that directory.
|
|
|
03-07-2005, 12:49 PM
|
#13
|
LQ Newbie
Registered: Mar 2005
Posts: 28
Original Poster
Rep:
|
Hi lihmin & thx for your answer, but somehow this isn't working :!(
I did everything like this:
Code:
chown root:mygroup /root/.myprog
chown root:mygroup /root/.myprog/*
chmod 0770 /root/.myprog
chmod 0770 /root/.myprog/*
ln -s /root/.myprog /home/myuser/.myprog
chown root:mygroup /home/myuser/.myprog
chmod 0770 /home/myuser/.myprog
The User `myuser` is _definitely_ in the Group `mygroup`.
Maybe I did something wrong?
I wouldn't mind "swap" 'ing the partition layout, but I really have no clue about that - and `man -k swap` didn't find anything I could use in that context - so how exactly do I "swap" ?
There isn't a possibility of data-loss, is there?
Thanks & bye bye~,
MHOOO
|
|
|
03-07-2005, 08:05 PM
|
#14
|
LQ Newbie
Registered: Sep 2003
Location: Singapore
Posts: 23
Rep:
|
first if /root is not accessible by mygroup then /root/.mygroup is not acessible also even with permision 777
second u dun need to chmod a symlink since it usually is 777.
if u insists to use /root then chown root:mygroup /root ; chmod 750 /root
chown -R /root/.myprog
& show us the result of grep mygroup /etc/group.
& make sure yr script does not change the permission of /root/.myprog
i recommed u use another directory mkdir /myuser for better sense; ln -s ... chown ... chmod ...
|
|
|
03-08-2005, 08:41 AM
|
#15
|
LQ Newbie
Registered: Mar 2005
Posts: 28
Original Poster
Rep:
|
Alright, I got it :!)
It works like this - seems like the problem was because the User `myuser` didn't have any access to the `/root` dir.
Thanks for everything & bye bye~,
MHOOO
|
|
|
All times are GMT -5. The time now is 03:06 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|