Sponsored Content
Top Forums UNIX for Advanced & Expert Users Run shell script as different user Post 69573 by mskarica on Saturday 16th of April 2005 02:24:26 AM
Old 04-16-2005
Run shell script as different user

I want to start off by saying thanks to everyone here, you're answers and suggestions are always very helpful.

I have a shell script which is invoked when an email is received. This shell script extracts any attachments that are sent with this email, and then runs a script which submits these files to a repository. The problem is that when the script is envoked, "daemon" is the owner of the files that are created, so the ci and co functions will not work properly. I'm trying to find a way where I can change the owner of the process when the script is envoked.

For example, when the script is envoked, the owner is "daemon", but I need to change the owner to "myUserName", so that when the files are created and the other scripts/commands are called, the system will think that "myUserName" is the person running all of the commands/scripts.

Is this at all possible?
 

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
POSTFIX(1)						      General Commands Manual							POSTFIX(1)

NAME
postfix - Postfix control program SYNOPSIS
postfix [-c config_dir] [-D] [-v] command DESCRIPTION
This command is reserved for the super-user. To submit mail, use the Postfix sendmail command. The postfix command controls the operation of the Postfix mail system: start or stop the master daemon, do a health check, and other main- tenance. The postfix command sets up a standardized environment and runs the postfix-script shell script to do the actual work. The following commands are implemented: check Validate the Postfix mail system configuration. Warn about bad directory/file ownership or permissions, and create missing directo- ries. start Start the Postfix mail system. This also runs the configuration check described above. stop Stop the Postfix mail system in an orderly fashion. Running processes are allowed to terminate at their earliest convenience. Note: in order to refresh the Postfix mail system after a configuration change, do not use the start and stop commands in succes- sion. Use the reload command instead. abort Stop the Postfix mail system abruptly. Running processes are signaled to stop immediately. flush Force delivery: attempt to deliver every message in the deferred mail queue. Normally, attempts to deliver delayed mail happen at regular intervals, the interval doubling after each failed attempt. reload Re-read configuration files. Running processes terminate at their earliest convenience. The following options are implemented: -c config_dir Read the main.cf and master.cf configuration files in the named directory instead of the default configuration directory. Use this to distinguish between multiple Postfix instances on the same host. -D (with postfix start only) Run each Postfix daemon under control of a debugger as specified via the debugger_command configuration parameter. -v Enable verbose logging for debugging purposes. Multiple -v options make the software increasingly verbose. ENVIRONMENT
The postfix command sets the following environment variables: MAIL_CONFIG Directory with Postfix configuration files. MAIL_VERBOSE This is set when the -v command-line option is present. MAIL_DEBUG This is set when the -D command-line option is present. CONFIGURATION PARAMETERS
The following main.cf configuration parameters are made available as process environment variables with the same names: command_directory Directory with Postfix administrative commands. daemon_directory Directory with Postfix daemon programs. config_directory Directory with Postfix configuration files and with administrative shell scripts. queue_directory The directory with Postfix queue files, with local inter-process communication endpoints, and with files needed for daemon programs that run in the optional chrooted environment. mail_owner The owner of Postfix queue files and of most Postfix processes. setgid_group The group for mail submission and queue management commands. sendmail_path The full pathname for the Postfix sendmail command. newaliases_path The full pathname for the Postfix newaliases command. mailq_path The full pathname for the Postfix mailq command. manpage_directory The directory for the Postfix on-line manual pages. sample_directory The directory for the Postfix sample configuration files. readme_directory The directory for the Postfix README files. Other configuration parameters import_environment List of names of environment parameters that can be imported from non-Postfix processes. FILES
$config_directory/postfix-script, administrative commands $config_directory/main.cf, configuration parameters $config_directory/master.cf, Postfix daemon processes SEE ALSO
master(8) Postfix master program LICENSE
The Secure Mailer license must be distributed with this software. AUTHOR(S) Wietse Venema IBM T.J. Watson Research P.O. Box 704 Yorktown Heights, NY 10598, USA POSTFIX(1)
All times are GMT -4. The time now is 12:00 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy