PATH in Linux/Unix


I have a service account (Joe_Tester) and I am trying to set the paths, ld_path.  The account does not have a login so how can I set this under su?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kent WSr. Network / Systems AdminCommented:
in /etc/passwd

Replace the users login path with whatever you want.
mcsweenSr. Network AdministratorCommented:
You can do this system wide
sudo nano /etc/pfofile.d/

Open in new window

Add this line to the file to append the path environment variable (you can set any you like the same way)
export PATH=$PATH:/path/you/want/to/append

Open in new window

You can set environment variables for an individual user (assumin ghtey are using bash or sh as their shell) with:

nano ~user_name/.bashrc

(or vi or whatever you are conmfortable with - that's a tilde before the user_name)

and add the line

    export LD_PATH=/lib/whatever:/usr/lib/secondlib

(do you mean LD_LIBRARY_PATH?)
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

when you say "The account does not have a login" do you mean no login shell or no login home dir or password not known?

How you intend to use su for this user?
Jack_son_Author Commented:
I think we are still unclear by what you mean by "no login".  what does the /etc/passwd entry for this user look like?  Do they have no shell entry, or an unavailable password (so they can't log in)?

Assuming it's just that they do not have a valid password, my ~/.bashrc fix (with
     export LD_LIBRARY_PATH=/lib/whatever:/usr/lib/secondlib
) will be fine for bash, or add it to ~/.profile if you are using /bin/sh - a look at your /etc/passwd line will tell us which shell you are using.
If they have no login, who or what would be using the path?
@ozo, I think we're assuming that "service account" means something that is a normal user, but the password is locked so that they can't log in normally.  For example, the daemon, statd and syslog users on some Linuxes, which run varous processes.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.