LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-15-2011, 04:59 AM   #1
Prabagaran
LQ Newbie
 
Registered: Mar 2009
Posts: 17

Rep: Reputation: Disabled
Question How to set PATH for all the users, permanently on Fedora 8?


Hi,

I am failing to set PATH for all the users on a linux box(Fedora 8), permanently.

Basically, I have installed two different versions of python(2.5 & 2.7)

Python2.5 path is /usr/bin and it is set by default for all users(not by me, also i don't know how ) and it is working fine.

Python2.7 path is /usr/bin/Python27/bin, so tried this:
PATH=$PATH:/usr/bin/Python27/bin
And it worked only for that particular session and for only root, as I set path from root user.

So, i need this to be set for all the users on the linux box, including root, more importantly as permanent. So if any user types "python27" at the command prompt, it should give python2.7 prompt.

Any help would be appreciated.

And if any more information needed, I would do that.

Thanks in advance..

--PL
 
Old 04-15-2011, 05:05 AM   #2
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,057

Rep: Reputation: Disabled
Hi,

I don't know Fedora, but I suppose you could set PATH in /etc/profile, see 'man bash' and http://stefaanlippens.net/bashrc_and_others
 
Old 04-17-2011, 08:38 AM   #3
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
@ Reply

Usually to make changes for a single user permanent you put it in .bashrc_profile located under that user's home directory.

However, if you want to make this setting global then put the lines that you mentioned at the end of /etc/environment file and I think that should do the trick.
 
Old 04-17-2011, 08:43 AM   #4
asim.mcp
LQ Newbie
 
Registered: Oct 2006
Posts: 28

Rep: Reputation: 15
Usually made changes which effect to all users.
/etc/profile
 
Old 11-05-2015, 08:53 PM   #5
zillur
Member
 
Registered: Apr 2015
Posts: 217

Rep: Reputation: Disabled
Hi there, I also need to set path for all my users. here is my bash profile: which part I need to modify? Thanks in advance.

# /etc/profile

# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc

# It's NOT a good idea to change this file unless you know what you
# are doing. It's much better to create a custom.sh shell script in
# /etc/profile.d/ to make custom changes to your environment, as this
# will prevent the need for merging in future updates.

pathmunge () {
case ":${PATH}:" in
*:"$1":*)
;;
*)
if [ "$2" = "after" ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
esac
}


if [ -x /usr/bin/id ]; then
if [ -z "$EUID" ]; then
# ksh workaround
EUID=`id -u`
UID=`id -ru`
fi
USER="`id -un`"
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"
fi

# Path manipulation
if [ "$EUID" = "0" ]; then
pathmunge /usr/sbin
pathmunge /usr/local/sbin
else
pathmunge /usr/local/sbin after
pathmunge /usr/sbin after
fi

HOSTNAME=`/usr/bin/hostname 2>/dev/null`
HISTSIZE=1000
if [ "$HISTCONTROL" = "ignorespace" ] ; then
export HISTCONTROL=ignoreboth
else
export HISTCONTROL=ignoredups
fi

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL

# By default, we want umask to get set. This sets it for login shell
# Current threshold for system reserved uid/gids is 200
# You could check uidgid reservation validity in

# /usr/share/doc/setup-*/uidgid file
if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then
umask 002
else
umask 022
fi

for i in /etc/profile.d/*.sh ; do
if [ -r "$i" ]; then
if [ "${-#*i}" != "$-" ]; then
. "$i"
else
. "$i" >/dev/null
fi
fi
done

unset i
unset -f pathmunge
 
Old 11-05-2015, 10:08 PM   #6
Doug G
Member
 
Registered: Jul 2013
Posts: 749

Rep: Reputation: Disabled
Fedora 8 is pretty ancient, and I'm not sure there was /etc/profile. I recall using /etc/bashrc for such tasks.
 
Old 11-05-2015, 10:34 PM   #7
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,624

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
zillur
if you are using Fedora 8 ... you have a big PROBLEM

the current is Fedora 23
support for fedora 21 ends in less than a month


write a script and place it in /etc/profile.d folder

AS PER THE WARNING IN THE FILE YOU POSTED !!!
Quote:

# /etc/profile

# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc

# It's NOT a good idea to change this file unless you know what you
# are doing. It's much better to create a custom.sh shell script in
# /etc/profile.d/ to make custom changes to your environment, as this
# will prevent the need for merging in future updates.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
just saying - hi [ how to set path in solaris permanently ] linuxmsg Solaris / OpenSolaris 20 08-29-2014 03:23 AM
how to set path? permanently AVD_ZM Ubuntu 5 03-06-2007 04:41 PM
How to set path permanently for a particular user Sifvion Slackware 14 10-16-2002 11:02 AM
How to set PATH permanently chandhru Linux - Newbie 3 09-24-2002 12:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 02:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration