Sponsored Content
Top Forums Shell Programming and Scripting Running a command or script as root Post 73084 by rm-r on Friday 27th of May 2005 08:58:03 AM
Old 05-27-2005
OK, I found a few ways to do that but I was approaching the problem from the wrong angle.

You cannot modify the cron file owned by root, or so it says in man. You have to use the crontab command. This being established, how do I allow a user to modify another user's cron table? I first thought of sudo but it's not installed here and I would have to convince the sys-admins to do this - more problems...

Remote Shell! That is the way to go! You setup the user who owns the cron table to accept remote access from select users (create a .rhosts file in this user's home dir).

Then, those select users can rsh (remsh on certain systems) their way into the owner's crontab entry:
$ rsh <server-name> -l <cron-userid> "crontab <new-cron-file>"

Voila!

Thanks to those who replied.

Réal
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

As root , running script as different user with su - problem

Dear All I am running into a situation where I am running a script as another user lets say oracle using su command as below, and the script fails because the .profile of oracle is not executed so the environment variables are not set. cat /etc/passwd | grep oracle... (4 Replies)
Discussion started by: dbsupp
4 Replies

2. Cybersecurity

Running script through SSH as root

Hi all, I have a situation where I have a shell script that I need to run remotely on multiple *nix machines via SSH. Unfortunately, some of the commands in it require root access. I know that best practices for ssh entail configuring it so that the root account cannot log in, you need to... (4 Replies)
Discussion started by: irinotecan
4 Replies

3. Shell Programming and Scripting

Issue running script as root

1) Environment:Red Hat Linux, bash shell Script to be run owned by user :myUser Home environment of myUser: pathto/home 2) ESP agent with root access will run JobXXX.sh su - myUser -c "/pathto/home/bin/script.sh" where script.sh has some echo statements and an exit statement in the end... (4 Replies)
Discussion started by: cj09
4 Replies

4. Shell Programming and Scripting

Script for running root based C++ code

Hi all, I have to run C++ file using root programming, using following commands: $root -l root .L TwoTrees.C++ root TwoTrees t root t.Loop() root.q I wonder if I can write script to do the following. Thanks Pooja (12 Replies)
Discussion started by: nrjrasaxena
12 Replies

5. Solaris

How to know the script/command executor as root?

In my ENV every one has sudo access to "XYZ" user and they run the script any time. can you please suggest how could I identify who has executed script after sudo user XYZ ? OS : sunSolaris process of login Step 1 : user login with his own username and PWD Step 2 : sudo to XYZ user... (1 Reply)
Discussion started by: yogendra.barode
1 Replies

6. UNIX for Dummies Questions & Answers

Run script as root from command line

I have a script (ksh) that has permissions 775 and owned by root.system. This script takes the parameter of a full file name and chmods the file to 666 and changes ownership to user smith.staff. ex: modify_file.ksh /home/smith/filea modify_file.ksh has 775 and root.system ownership. The... (1 Reply)
Discussion started by: mlacriola
1 Replies

7. Shell Programming and Scripting

Running a script as root but with different users inside

Hi All, my script.sh has the below lines, and i need to run the script as root or wam. please tell me if this will work #!/bin/bash sudo -t wam /usr/local/wam/stopwam -r ------- this needs run as wam user /usr/local/web/stopweb -a --- this needs to run as... (18 Replies)
Discussion started by: nanz143
18 Replies

8. Shell Programming and Scripting

Root running a script calling to scp using user "xyz" is not authenticating!

Close duplicate thread. (0 Replies)
Discussion started by: denissi
0 Replies

9. UNIX for Beginners Questions & Answers

Running a command as another non-root user

Hi, I am trying to run a command within my KSH script as another user due to permission issues, now both users are non root. I have tried the following command and was unsuccessful: echo "<password>" | sudo -S -u <username> -k command Can I use sudo to run a command as a non-root user? (5 Replies)
Discussion started by: MIA651
5 Replies

10. Programming

Running a script as root in the script

hi all, i think i have got the solution for this but want to run it past you guys first when i run a script sometimes its necassary to sudo to root so it can create users, chmod etc etc, the normal way for me doing this is just to simply run the script as root but i have created a user... (11 Replies)
Discussion started by: robertkwild
11 Replies
Tk_SetAppName(3TK)					       Tk Library Procedures						Tk_SetAppName(3TK)

__________________________________________________________________________________________________________________________________________________

NAME
Tk_SetAppName - Set the name of an application for ``send'' commands SYNOPSIS
#include <tk.h> CONST char * Tk_SetAppName(tkwin, name) ARGUMENTS
Tk_Window tkwin (in) Token for window in application. Used only to select a particular application. CONST char *name (in) Name under which to register the application. _________________________________________________________________ DESCRIPTION
Tk_SetAppName associates a name with a given application and records that association on the display containing with the application's main window. After this procedure has been invoked, other applications on the display will be able to use the send command to invoke operations in the application. If name is already in use by some other application on the display, then a new name will be generated by appending `` #2'' to name; if this name is also in use, the number will be incremented until an unused name is found. The return value from the proce- dure is a pointer to the name actually used. If the application already has a name when Tk_SetAppName is called, then the new name replaces the old name. Tk_SetAppName also adds a send command to the application's interpreter, which can be used to send commands from this application to others on any of the displays where the application has windows. The application's name registration persists until the interpreter is deleted or the send command is deleted from interp, at which point the name is automatically unregistered and the application becomes inaccessible via send. The application can be made accessible again by calling Tk_SetAppName. Tk_SetAppName is called automatically by Tk_Init, so applications don't normally need to call it explicitly. The command tk appname provides Tcl-level access to the functionality of Tk_SetAppName. KEYWORDS
application, name, register, send command ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +--------------------+-----------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +--------------------+-----------------+ |Availability | SUNWTk | +--------------------+-----------------+ |Interface Stability | Uncommitted | +--------------------+-----------------+ NOTES
Source for Tk is available on http://opensolaris.org. Tk 4.0 Tk_SetAppName(3TK)
All times are GMT -4. The time now is 06:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy