Sponsored Content
Top Forums UNIX for Advanced & Expert Users Run shell script as different user Post 70313 by chuckuykendall on Wednesday 27th of April 2005 12:01:39 PM
Old 04-27-2005
Do you know the name of the userid that you want to change to inside the script? If so, you can do a `chown userid` inside the script once the file has been placed in that userid's directory.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Have script run as a different user

Hi all, I'm a newbie to the Linux world. I have a script that needs to run under "UserB". But I don't want to give out the password to UserB. Is there a way to setup the script to run as "UserB" when UserA runs it. Thanks in advance for your assistance. (1 Reply)
Discussion started by: mikey20
1 Replies

2. UNIX for Dummies Questions & Answers

shell script run by user or cron job ?

My shell script runs fine both as a cron job and when i issue it. However, I wish to differentiate when it runs as a cron-job so the "echo" statements are not issued (they get mailed to me, which i don't want). I tried checking $USER but since the cron was created in my user that does not... (5 Replies)
Discussion started by: sentinel
5 Replies

3. Shell Programming and Scripting

how to run script? call other script? su to another user? make a cron?

Good morning. I am searching for "how-to"'s for some particular questions: 1. How to write a script in HP-UX 11. 2. How to schedule a script. 3. How to "call" scripts from the original script. 4. How to su to another user from within a script. This is the basics of what the... (15 Replies)
Discussion started by: instant000
15 Replies

4. Shell Programming and Scripting

Can root user run chmod 000 permission shell script?

Hi, I have a shell script file which is set to access permission 000. When I login as root (sudo su) and try to run this script, I am getting the Permission denied error. I have read somewhere that root admin user can execute any kind of permission script. Then why this behavior? However, I can... (1 Reply)
Discussion started by: royalibrahim
1 Replies

5. Shell Programming and Scripting

Forcing another user to run a shell script (su)

I'm trying to use su (as myuser) to force another user (theuser) to run a shell script (thescript.sh): su theuser -c /home/theuser/thescript.sh However I'm running this from another script, and it is asking for theuser's password. I would rather avoid displaying it in the file (using echo... (2 Replies)
Discussion started by: asdfgg
2 Replies

6. AIX

AIX How to run a Shell Script by changing the User

Hi All, Currently our application is running on the server having AIX 5.3 OS. What we intend to do is to run a shell script owned by another user and needs to be run as that particular user. I was trying to create a shell script using the su command before running the actual script (which... (4 Replies)
Discussion started by: acoomer
4 Replies

7. Shell Programming and Scripting

Best way to run a shell with different user

Hi , we got autosys for scheduling our jobs. Autosys user logs in to the Linux box and need to execute a shell script. problem here is user requires admin privileges on database to complete the task. Since scheduling is maintained by different team I don't want autosys user to have admin privileges... (1 Reply)
Discussion started by: rush143
1 Replies

8. Solaris

Run commans as no login shell user

Hi All, I have problem running a command with another user who has no login shell the os is solaris 10 i am root and doing the following: su user -s /bin/bash "ls" no output .. no error messages if su - user i got No directory Please use CODE tags as required by forum... (2 Replies)
Discussion started by: BF_DEV
2 Replies

9. Shell Programming and Scripting

Shell script run in a case statement call to run a php file, also Perl

Linux System having all Perl, Python, PHP (and Ruby) installed From a Shell script, can call a Perl, Python, PHP (or Ruby ?) file eg eg a Shell script run in a case statement call to run a php file, also Perl or/and Python file??? Like #!/usr/bin/bash .... .... case $INPUT_STRING... (1 Reply)
Discussion started by: hoyanet
1 Replies
Net::XMPP::JID(3pm)					User Contributed Perl Documentation				       Net::XMPP::JID(3pm)

NAME
Net::XMPP::JID - XMPP JID Module SYNOPSIS
Net::XMPP::JID is a companion to the Net::XMPP module. It provides the user a simple interface to set and retrieve all parts of a Jabber ID (userid on a server). DESCRIPTION
To initialize the JID you must pass it the string that represents the jid from the XML packet. Inside the XMPP modules this is done automatically and the JID object is returned instead of a string. For example, in the callback function for the XMPP object foo: use Net::XMPP; sub foo { my $foo = new Net::XMPP::Foo(@_); my $from = $foo->GetFrom(); my $JID = new Net::XMPP::JID($from); . . . } You now have access to all of the retrieval functions available. To create a new JID to send to the server: use Net::XMPP; $JID = new Net::XMPP::JID(); Now you can call the creation functions below to populate the tag before sending it. Retrieval functions $userid = $JID->GetUserID(); $server = $JID->GetServer(); $resource = $JID->GetResource(); $JID = $JID->GetJID(); $fullJID = $JID->GetJID("full"); $baseJID = $JID->GetJID("base"); Creation functions $JID->SetJID(userid=>"bob", server=>"jabber.org", resource=>"Work"); $JID->SetJID('blue@moon.org/Home'); $JID->SetUserID("foo"); $JID->SetServer("bar.net"); $JID->SetResource("Foo Bar"); METHODS
Retrieval functions GetUserID() - returns a string with the userid of the JID. If the string is an address (bob%jabber.org) then the function will return it as an address (bob@jabber.org). GetServer() - returns a string with the server of the JID. GetResource() - returns a string with the resource of the JID. GetJID() - returns a string that represents the JID stored GetJID("full") within. If the "full" string is specified, then GetJID("base") you get the full JID, including Resource, which should be used to send to the server. If the "base", string is specified, then you will just get user@server, or the base JID. Creation functions SetJID(userid=>string, - set multiple fields in the jid at server=>string, one time. This is a cumulative resource=>string) and over writing action. If you set SetJID(string) the "userid" attribute twice, the second setting is what is used. If you set the server, and then set the resource then both will be in the jid. If all you pass is a string, then that string is used as the JID. For valid settings read the specific Set functions below. SetUserID(string) - sets the userid. Must be a valid userid or the server will complain if you try to use this JID to talk to the server. If the string is an address then it will be converted to the % form suitable for using as a User ID. SetServer(string) - sets the server. Must be a valid host on the network or the server will not be able to talk to it. SetResource(string) - sets the resource of the userid to talk to. AUTHOR
Ryan Eatmon COPYRIGHT
This module is free software, you can redistribute it and/or modify it under the LGPL. perl v5.14.2 2012-11-06 Net::XMPP::JID(3pm)
All times are GMT -4. The time now is 12:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy