PATH in Linux/Unix

Posted on 2014-09-02
Last Modified: 2014-09-18

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?

Question by:Jack_son_
    LVL 12

    Assisted Solution

    in /etc/passwd

    Replace the users login path with whatever you want.
    LVL 21

    Assisted Solution

    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

    LVL 19

    Assisted Solution

    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?)
    LVL 40

    Assisted Solution

    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?

    Author Comment

    yes, the LD_LIBRARY_PATH
    LVL 19

    Assisted Solution

    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.
    LVL 84

    Expert Comment

    If they have no login, who or what would be using the path?
    LVL 19

    Accepted Solution

    @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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap ( Version 1.2 2.      Jpcap( Version 0.6 Prerequisite: 1.      GCC …
    Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
    Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
    Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now