Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 04-22-2004, 06:52 AM   #1
Registered: Oct 2003
Distribution: redhat
Posts: 63

Rep: Reputation: 15
changing the user inside a shell script


when ever i make a script with the contents


sys -lu user_name;


and run it

the user changes,but the list command dosent work .
ls works only after i quit from the new user_name area.

how can i avoid this if i want to run some command's under the user_name

Old 04-22-2004, 07:29 AM   #2
Senior Member
Registered: Apr 2003
Location: Eire
Distribution: Slackware 12.0, OpenSuse 10.3
Posts: 1,120

Rep: Reputation: 45
Don't know about sys but how about su

su user_name -c ls


man suauth

if you want to avoid having to enter a password
Old 04-22-2004, 07:44 AM   #3
Registered: Oct 2003
Distribution: redhat
Posts: 63

Original Poster
Rep: Reputation: 15
sys -lu user_name -c command

the above thing works without authenticaton and also executes the command.

But i want to run many commands .Even making all the commands in to a script is not enough here.



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
Problem executing mv command inside shell script pablogosse Linux - General 7 12-16-2009 12:21 PM
Shell script inside shell script treotan Linux - General 4 02-19-2009 06:34 AM
help changing case on arguments to bourne shell script Maldain Programming 2 05-03-2005 10:18 AM
changing user in a shell script sanjith11 Programming 6 03-22-2004 01:18 PM
Running FTP inside Shell Script truncates files jbhanc0125 Red Hat 3 01-16-2004 11:37 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:04 AM.

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