LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris and OpenSolaris.
General Sun, SunOS and Sparc related questions also go here.

Notices

Reply
 
Search this Thread
Old 06-04-2008, 02:46 AM   #1
wrapster
Member
 
Registered: May 2008
Posts: 155

Rep: Reputation: 30
How do i change to super user then revert back to ordinary user ,using shell script?


Hi all,

I am trying to eject the cdrom from a livecd after certain stage...
Now assuming that it is possible to eject,please consider my issue!!!

The OS boots into a regular user by default...so i am unable to use the eject command to push out the drive...
However if i try pfexec eject it works....but then again it works only when the system is completely up and running not at some intermittent stage in the boot process.

How do i change the my id to a Superuser then execute the eject command ,then once the eject is done with, i would like to revert back to the ordinary user?
Secondly this code should be incorporated into one of the boot scripts,
So that after a certain stage during the boot, the drive automatically ejects......

How do i do it.....

PS:i urge you to consider that ejecting the media on a livecd is possible.

Thanks
 
Old 06-04-2008, 03:06 AM   #2
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Mint, OL
Posts: 9,493

Rep: Reputation: 355Reputation: 355Reputation: 355Reputation: 355
I understand the live-cd is copied on RAM to allow ejection when done. How would the OS survive an ejection if it is depending on the live-cd media content at an earlier stage ?

What is the issue with pfexec ? It is the preferred way to run privileged commands as a regular user under Solaris.
 
Old 06-04-2008, 03:44 AM   #3
wrapster
Member
 
Registered: May 2008
Posts: 155

Original Poster
Rep: Reputation: 30
oh, so you want it out of me anyhow...
i have made this possible ...
The copy is done at an earlier stage itself...
Its not goin to wait till the gui is up for the copy to happen....
its now a part of the boot process ,meaning at a very primitive stage in the boot process itself the required files are copied to ram then on the cd becomes redundant....the remaining boot process including getting the gui will be done from ram

The pfexec program is used to execute commands with the
attributes specified by the user's profiles in the exec_attr file...

Could you think of a script now?

Last edited by wrapster; 06-04-2008 at 03:47 AM.
 
Old 06-04-2008, 06:19 AM   #4
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Mint, OL
Posts: 9,493

Rep: Reputation: 355Reputation: 355Reputation: 355Reputation: 355
Sorry but I still don't understand where the problem lies. Do you want the cdrom to be ejected after the user logs in or before ?

What happens when you run the "eject cdrom" command ?
 
Old 06-04-2008, 08:33 AM   #5
wrapster
Member
 
Registered: May 2008
Posts: 155

Original Poster
Rep: Reputation: 30
i want the cdrom to be ejected after all files have been copied on RAM and at the point whrer the boot process begins from ram....

I have located the scripts that run after the copy is done, and i am incorporating this script in that file...

I really dont mind if the ejection happens as soon as the copy is done or when the gui is up...I just want it to happen ,thats all.

This is what i do,
Code:
echo "changing user, and ejecting " >/dev/msglog
exec su - root -c eject 2>/dev/msglog &
rpid=$!
wait $rpid
if [ $? -eq 0 ];then
echo "how was it??" >/dev/msglog
else
echo "unlucky soul" >/dev/msglog
fi
The strange thing is ,if i make a script out of it,and then execute it as an ordinary user...(once the gui is up)it works flawlessly,
There is a momentary change in the user and then the eject happens , then i am taken back to ord user...

But if i try using this in the boot script i get no errors but still the ejection wont happen??

If its easier to perform this action once the gui is up, am ready to give that a try as well...
Could you please specify as to,howi can do it?

Thanks
 
Old 06-04-2008, 10:52 AM   #6
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Mint, OL
Posts: 9,493

Rep: Reputation: 355Reputation: 355Reputation: 355Reputation: 355
Why do you need to su in your copy script while I assume it already runs as root ?

Are you sure the cdrom filesystem is unmounted ? This is a mandatory prerequisite to media ejection.
 
Old 03-18-2009, 03:37 AM   #7
swapanxavier
LQ Newbie
 
Registered: Jan 2006
Location: India, North-East region
Distribution: knowlege sharing
Posts: 7

Rep: Reputation: 0
vlc run problem in f10

Quote:
Originally Posted by wrapster View Post
Hi all,

I am trying to eject the cdrom from a livecd after certain stage...
Now assuming that it is possible to eject,please consider my issue!!!

The OS boots into a regular user by default...so i am unable to use the eject command to push out the drive...
However if i try pfexec eject it works....but then again it works only when the system is completely up and running not at some intermittent stage in the boot process.

How do i change the my id to a Superuser then execute the eject command ,then once the eject is done with, i would like to revert back to the ordinary user?
Secondly this code should be incorporated into one of the boot scripts,
So that after a certain stage during the boot, the drive automatically ejects......

How do i do it.....

PS:i urge you to consider that ejecting the media on a livecd is possible.

Thanks
pliz find me solution for running the vlc in f10
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
where to get linux administrator script, ex: script to let's user change user info. hocheetiong Linux - Server 1 03-17-2008 12:06 AM
Script with root privileges running by an ordinary user MOCKBA Linux - Newbie 3 02-09-2007 03:33 PM
Can my shell script change the password of user ? prabhatsoni Linux - Software 1 05-27-2006 02:06 AM
How can an ordinary user change a file's ownership? garymansell Red Hat 1 04-01-2004 10:35 AM


All times are GMT -5. The time now is 08:59 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration