Sudo command changes environment variables

When you run sudo command it switches user to “supper user” and environment variables also change. This can be annoying.
For example, on amazon free-tier micro instance you ssh to it as ec2-user but often (almost always I would say) need to run commands as sudo. To solve the issue I always do:

sudo bash

as my first command when I ssh to the instance. This creates shell with root privileges and I don’t need to type sudo all the time and deal with environment variables issue.

This entry was posted in Bash, EC2. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s