> ## Content Index
> Fetch the complete content index at: https://kudithipudi.org/llms.txt
> Use this file to discover other available public pages before exploring further.

# HOW TO : Pass environment variables when using sudo
- URL: https://kudithipudi.org/how-to-pass-environment-variables-when-using-sudo/
- Published: 2009-05-21T04:27:17.000Z
- Updated: 2009-05-21T04:27:17.000Z
- Description: Say you need to sudo as a particular user and run a command and at the same time you need to pass an environmental variable to...
- Author: admin
- Tags: Databases, HOWTO, Linux, Technology, Uncategorized, #wp, #wp-post, #Import 2026-08-23 02:32

Say you need to sudo as a particular user and run a command and at the same time you need to pass an environmental variable to the command, you can do it by passing the command in doublequotes.

For example, I want to start Oracle while I am logged in as another user (vinay), I can start the database using dbstart by issues

`"sudo su - oracle -c "dbstart /$ORACLE_HOME"`

$ORACLE\_HOME is an environmental variable listed under user oracle’s environment.

Needless to say, you need to ensure that you have sudo configured to allow your userID to su to oracle.