LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-20-2007, 05:09 PM   #1
peji
LQ Newbie
 
Registered: Mar 2005
Posts: 12

Rep: Reputation: 0
Thumbs up Launch a script as it belongs to another user


Hi folks,

I hope you can point me out in the right direction. I think the subject is quite explicit but let me explain you a little bit more.
When I log in as user A for example I'd like to launch a script as it was launched by other user, for example user B, so when I execute ps command I'd like to see that the process belong to user B and not to A. All this done with a command from the shell, for sure it's possible but I donīt know the way to do it. I have checked the "man" for some commands but without success.

Thanks in advance for your comments.

Cheers.
 
Old 03-20-2007, 05:12 PM   #2
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 472Reputation: 472Reputation: 472Reputation: 472Reputation: 472
You'd need to use the su command
Code:
su -userb <command>
 
Old 03-21-2007, 12:09 AM   #3
nmh+linuxquestions.o
Member
 
Registered: Feb 2007
Posts: 135

Rep: Reputation: 15
Though su is the standard answer, I suggest checking out sudo as an alternative.
 
Old 03-21-2007, 04:48 AM   #4
peji
LQ Newbie
 
Registered: Mar 2005
Posts: 12

Original Poster
Rep: Reputation: 0
Hi,

sorry for the delay, I've checked what you posted:

su userb <command>, and it works, thanks

related to sudo, is sudo a command for any particular distro or it's a general one? because I tried it in a server with this kernel:

Linux debian 2.2.20-idepci #1 Sat Apr 20 12:45:19 EST 2002 i686 GNU/Linux

maybe it's an old kernel version and "sudo" wasn't implemented yet or maybe "sudo" is a bash command feature, in this case the bash version implented in this machine is:

bash --version
bash --version
GNU bash, version 2.05b.0(1)-release (i386-pc-linux-gnu)
Copyright (C) 2002 Free Software Foundation, Inc.


thanks again for your comments.

Cheers.
 
Old 03-23-2007, 03:55 PM   #5
wpn146
Member
 
Registered: Jan 2005
Distribution: Solaris, Linux Fedora Core 6
Posts: 170

Rep: Reputation: 30
You could set the "suid" bit on the script file. Just keep in mind that you have just opened the door for all hackers that want to become the user that owns the file. The "suid" bit on a file owned by "root" can be a serious security risk.

Overall, the "sudo" command would allow you to maintain better control of your system. "Sudo" is a separate package which may or may not be standard in your distro, but is probably available to you. "sudo" is not connected with bash. It is completely separate.
 
Old 03-23-2007, 04:06 PM   #6
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671
Linux doesn't support the "suid" bit on scripts.
 
Old 03-24-2007, 02:38 AM   #7
nmh+linuxquestions.o
Member
 
Registered: Feb 2007
Posts: 135

Rep: Reputation: 15
Quote:
Originally Posted by peji
<cut>
related to sudo, is sudo a command for any particular distro or it's a general one? because I tried it in a server with this kernel:
<cut>
sudo is not built in to bash, so you may have to install it:
Code:
aptitude install sudo
 - or -
apt-get install sudo
 
  


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
Launch CGI script from shell alex986best Linux - Newbie 2 06-28-2006 07:28 AM
how to launch a script automatically newusermike Linux - Newbie 2 08-12-2005 07:19 PM
launch script for thunderbird? webazoid Linux - Software 2 07-11-2004 10:31 PM
firefox launch script curmudgeon42 Linux - Software 2 06-06-2004 09:20 PM
how do i create a script and launch it with x? reiggin Linux - Newbie 1 09-11-2003 10:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:39 AM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration