LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 08-20-2005, 01:46 PM   #1
polemon
Member
 
Registered: Jun 2005
Distribution: Fedora 18, Ubuntu 11.10, Ubuntu Server 11.10, DamnSmallLinux 3.4.4, FreeDOS 1.1, OpenBSD 5.0
Posts: 194

Rep: Reputation: 31
[FC4] how to make commands more accessible?


Hi!

In order to use ifconfig, i either have to go to the /sbin directory and go ./ifconfig, or i have to type /sbin/ifconfig.

How can i make it more easy to use by making it available by typing just ifconfig from anywhere?
 
Old 08-20-2005, 01:50 PM   #2
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Add the folder to your $PATH environment variable (search for how to do this, cos right now I can't remember the syntax).
 
Old 08-20-2005, 02:09 PM   #3
polemon
Member
 
Registered: Jun 2005
Distribution: Fedora 18, Ubuntu 11.10, Ubuntu Server 11.10, DamnSmallLinux 3.4.4, FreeDOS 1.1, OpenBSD 5.0
Posts: 194

Original Poster
Rep: Reputation: 31
K, thanks, maby there are othe possibilities?
(adding /sbin seems a bit dangerous for me...)
 
Old 08-20-2005, 11:19 PM   #4
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 53
most people set /sbin and /usr/sbin in PATH for root
this could be in /etc/profile or /root/.bash_profile

Code:
if [ $EUID -eq 0 ] ; then
        PATH=/sbin:/usr/sbin:$PATH
fi
if someone is cleaver enough to become root user then they already know stuff is in /sbin /usr/sbin
i don't think hiding those directories will help alot

but you can always just write aliases to the command with the fullpath you know in /root/.bashrc
Code:
if [ `whoami` = "root" ]; then
alias ifconfig='/sbin/ifconfig'
fi

Last edited by foo_bar_foo; 08-20-2005 at 11:24 PM.
 
Old 08-20-2005, 11:52 PM   #5
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
There's absolutely nothing unsafe about adding directories to your user's $PATH. You can't do anything damaging to the system with the commands therein unless you are root. I find it most convenient to add /sbin to my nonprivilidged user's $PATH.
 
Old 08-21-2005, 08:27 AM   #6
polemon
Member
 
Registered: Jun 2005
Distribution: Fedora 18, Ubuntu 11.10, Ubuntu Server 11.10, DamnSmallLinux 3.4.4, FreeDOS 1.1, OpenBSD 5.0
Posts: 194

Original Poster
Rep: Reputation: 31
Thanks for this very comprehensive Help, guys!
 
Old 08-21-2005, 10:13 AM   #7
grovesj2
LQ Newbie
 
Registered: Aug 2005
Posts: 16

Rep: Reputation: 0
The best way to do it is to change your /etc/profile file, you only have to comment out two lines:

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

Just comment out the lines that begin with "if" and "fi", it should then look like the above. This will make it so that every user will be able to run the commands they have permissions for without typing the absolute path.
 
  


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
Vino on FC4 - accessible before Gnome login? Mleahy Linux - Software 2 11-25-2005 03:26 AM
How to make my tfs external drive accessible to all not just root? banner Linux - General 1 06-28-2005 01:37 PM
Newbie trying to make Knoppix accessible from Windows over network! 26242 Linux - Networking 3 04-10-2005 11:16 AM
How to make HTTPS dir accessible only from local network and one IP adress nevarlen Linux - Security 4 02-11-2005 11:09 PM
make; make install commands in SuSE Linux 9.1 Personal johnerskine Linux - Newbie 6 06-23-2004 10:18 AM

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

All times are GMT -5. The time now is 03:34 AM.

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