LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-28-2005, 07:07 PM   #16
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682

The 'bin' in
PATH=/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin
is a directory. Some distros will have a bin/ directory in each users home directory and setup the $PATH variable to include it if it exists. I have a number of short scripts that I have written and this is where I put them.

First, read through the startup scripts section 'info bash' . It explains which files are read when you login, and which files are read when you simply open a new shell.

Second, find out which of these scripts are used on your system, and read through them. Often, one script will test for others and source them if they exist. ( Sourcing a script runs it in the same shell instead of a subshell, so variable changes are retained when it finishes. ).

You may for example have a /etc/profile on your system. On SuSE Linux, the comments near the top explain that you shouldn't touch this file but make additions to /etc/profile.local instead. So somewhere in '/etc/profile is a test for the /etc/profile.local which sources it if it exists.

If you want to make global PATH or alias changes, find out where your system currently sets them, and make your additions in the same place. For example, in Mandrake Linux, there is an 'aliasesrc' script that is sourced. Editing this file will change the aliases for all users.

___

Backing up a bit, I should explain why adding '.' to the PATH variable is not a good idea. Suppose you are in a directory that has world write permissions, and another user or a hacker had added a program called 'ls' which will wipe out your home directory. You don't know this and enter 'ls' to get a listing of the files in the directory. If you have '.' in the source path, then the 'ls' script in the current directory will run instead.
There are actually two lessons here. First, don't have '.' in your path. Second, world writable directories should be on partitions mounted with the 'noexec' and 'nodev' options. This is one reason why a server style setup will have a number of partitions, so that they can be mounted with different options to maximize security.

Last edited by jschiwal; 01-28-2005 at 07:13 PM.
 
  


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
Hi, one quesiton! malc Linux - Newbie 7 12-01-2005 02:20 AM
KUDZU quesiton waelaltaqi Linux - General 1 10-05-2005 03:15 PM
Quesiton about Scripts caps_phisto Linux - General 2 12-17-2004 09:50 AM
Dumb gkrellm quesiton stunter Linux - Software 2 06-21-2004 12:19 AM
Quesiton regarding Xinetd Ghost of War Linux - Security 1 04-20-2004 05:57 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:01 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