Sponsored Content
Full Discussion: Sudo help needed
Top Forums UNIX for Advanced & Expert Users Sudo help needed Post 302250858 by otheus on Friday 24th of October 2008 12:32:19 PM
Old 10-24-2008
Yeah, if you provide arguments for a particular sudo command to run, it can run only with those arguments. So it probably works just to do "sudo su - weblogic" but any additional arguments make a different command. Add a star to let the command be run with an argument.

But this isn't what you really want. What you really want is sudo configured to run the command as weblogic and bypass su altogether:

Code:
#!/bin/sh
exec sudo -u weblogic -H "$@"

And your sudoers file like:
Code:
ALL    ALL = (weblogic) NOPASSWD: /opt/weblogic/whateverscript.sh

 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Unable to use the Sudo command. "0509-130 Symbol resolution failed for sudo because:"

Hi! I'm very new to unix, so please keep that in mind with the level of language used if you choose to help :D Thanks! When attempting to use sudo on and AIX machine with oslevel 5.1.0.0, I get the following error: exec(): 0509-036 Cannot load program sudo because of the following errors:... (1 Reply)
Discussion started by: Chloe123
1 Replies

2. Cybersecurity

sudo /bin/sh or sudo su -

we are looking at changing the way we get root on our network. in our current system if an admin needs root access he just gets the root password and uses an su. some of our staff have decided that a sudo to "/bin/sh" will be easer. some of our staff think a sudo to "su -" will be better. I... (0 Replies)
Discussion started by: robsonde
0 Replies

3. AIX

sudo log and sudo auditing

Sudo In AIX, how to find out what commands have been run after a user sudo to another user? for example, user sam run 'sudo -u robert ksh' then run some commands, how can I (as root) find what commands have been run? sudo.log only contains sudo event, no activity logging. (3 Replies)
Discussion started by: jalite19
3 Replies

4. Shell Programming and Scripting

Any way to know beforehand if SUDO is (going to be) needed?

I'm using virtual file-system in /proc/ to print out 1) current working directory (CWD): ls /proc/$PID/cwd 2) command line*: cat /proc/$PID/cmdline and 3) # of open files: ls /proc/$PID/fdinfo | wc -l All above snippets are part of printfs. Now, some processes complain about SUDO... (1 Reply)
Discussion started by: courteous
1 Replies

5. Shell Programming and Scripting

ssh foo.com sudo command - Prompts for sudo password as visible text. Help?

I am writing a BASH script to update a webserver and then restart Apache. It looks basically like this: #!/bin/bash rsync /path/on/local/machine/ foo.com:path/on/remote/machine/ ssh foo.com sudo /etc/init.d/apache2 reloadrsync and ssh don't prompt for a password, because I have DSA encryption... (9 Replies)
Discussion started by: fluoborate
9 Replies

6. Shell Programming and Scripting

sudo: sorry, you must have a tty to run sudo

Hi All, I running a unix command using sudo option inside shell script. Its working well. But in crontab the same command is not working and its throwing "sudo: sorry, you must have a tty to run sudo". I do not have root permission to add or change settings for my userid. I can not even ask... (9 Replies)
Discussion started by: Apple1221
9 Replies

7. Shell Programming and Scripting

sudo: sorry, you must have a tty to run sudo

Hi, Have a need to run the below command as a "karuser" from a java class which will is running as "root" user. When we are trying to run the below command from java code getting the below error. Command: sudo -u karuser -s /bin/bash /bank/karunix/bin/build_cycles.sh Error: sudo: sorry,... (8 Replies)
Discussion started by: Satyak
8 Replies

8. UNIX for Advanced & Expert Users

Help needed in sudo access

I want to give root access to a user called denielr on server - tsprd01, but do not want to share root password. I have sudoers configured already. He should have all access equal to root. I made this entry in /etc/sudoers, but it is not working denielr tsprd01 =(root) NOPASSWD: ALL I tried to... (2 Replies)
Discussion started by: solaris_1977
2 Replies

9. Solaris

Sudo help needed

Hello, I have a wrapper script that I am trying to build/execute, which has two different sub scripts, which run as two separate users. Purpose is to mask the contents of the script and allow the user to execute utlrp.sql, which requires sys level privs to execute. User FORD logs in, and... (5 Replies)
Discussion started by: willyb
5 Replies
DHCPCD-RUN-HOOKS(8)					    BSD System Manager's Manual 				       DHCPCD-RUN-HOOKS(8)

NAME
dhcpcd-run-hooks -- DHCP client configuration script DESCRIPTION
dhcpcd-run-hooks is used by dhcpcd(8) to run any system and user defined hook scripts. System hook scripts are found in /libexec/dhcpcd-hooks and the user defined hooks are /etc/dhcpcd.enter-hook. and /etc/dhcpcd.exit-hook. The default install supplies hook scripts for configuring /etc/resolv.conf and the hostname. Your distribution may have included other hook scripts to say configure ntp or ypbind. A test hook is also supplied that simply echos the dhcp variables to the console from DISCOVER message. Each time dhcpcd-run-hooks is invoked, $interface is set to the interface that dhcpcd is run on and $reason is to the reason why dhcpcd-run-hooks was invoked. DHCP information to be configured is held in variables starting with the word new_ and old DHCP information to be removed is held in variables starting with the word old_. dhcpcd can display the full list of variables it knows how about by using the -V, --variables argument. Here's a list of reasons why dhcpcd-run-hooks could be invoked: PREINIT dhcpcd is starting up and any pre-initialisation should be done. CARRIER dhcpcd has detected the carrier is up. This is generally just a notification and no action need be taken. INFORM dhcpcd informed a DHCP server about it's address and obtained other configuration details. BOUND dhcpcd obtained a new lease from a DHCP server. RENEW dhcpcd renewed it's lease. REBIND dhcpcd has rebound to a new DHCP server. REBOOT dhcpcd successfully requested a lease from a DHCP server. IPV4LL dhcpcd failed to contact any DHCP servers but did obtain an IPV4LL address. STATIC dhcpcd has been configured with a static configuration which has not been obtained from a DHCP server. 3RDPARTY dhcpcd is monitoring the interface for a 3rd party to give it an IP address. TIMEOUT dhcpcd failed to contact any DHCP servers but was able to use an old lease. EXPIRE dhcpcd's lease or state expired and it failed to obtain a new one. RELEASE dhcpcd's lease was released back to the DHCP server for re-use. NAK dhcpcd received a NAK from the DHCP server. This should be treated as EXPIRE. NOCARRIER dhcpcd lost the carrier. The cable may have been unplugged or association to the wireless point lost. FAIL dhcpcd failed to operate on the interface. This normally happens when dhcpcd does not support the raw interface, which means it cannot work as a DHCP or ZeroConf client. Static configuration and DHCP INFORM is still allowed. STOP dhcpcd stopped running on the interface. DUMP dhcpcd has been asked to dump the last lease for the interface. TEST dhcpcd received an OFFER from a DHCP server but will not configure the interface. This is primarily used to test the variables are filled correctly for the script to process them. ROUTERADVERT dhcpcd has received an IPv6 Router Advertisment, or one has expired. FILES
When dhcpcd-run-hooks runs, it loads /etc/dhcpcd.enter-hook and any scripts found in /libexec/dhcpcd-hooks in a lexical order and then finally /etc/dhcpcd.exit-hook SEE ALSO
dhcpcd(8) AUTHORS
Roy Marples <roy@marples.name> BUGS
Please report them to http://roy.marples.name/projects/dhcpcd SECURITY CONSIDERATIONS
Little validation of DHCP options is done in dhcpcd itself. Instead, it is up to the hooks to handle any validation needed. To this end, some helper functions are provided, such as valid_domainname as used by the 20-resolv.conf hook to ensure that the hostname is not set to an invalid value. valid_path is also provided, but is currently unused by a stock hook script. BSD
March 19, 2012 BSD
All times are GMT -4. The time now is 07:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy