Solved

shell question

Posted on 2004-09-08
3
264 Views
Last Modified: 2013-12-15
hello.

I'm a newbie to  linux. I have Fedora Core 2 installed.
When it was newly installed, I could type in 'iwconfig" in the bash-shell and the program would run. I think i have done something wring, because now, this doesn't work. I have to type 'cd /sbin' and then './iwconfig'. How do i Solve this?

thanks..
0
Comment
Question by:daggodt
3 Comments
 
LVL 5

Accepted Solution

by:
willy134 earned 100 total points
ID: 12008090
I bet you were  logged in as root.   Root has the sbin in his path by default.  Also most of the programs in /sbin don't fully work for the everyday user.

however if you want to add the sbin to your path you can add this in your .profile

export PATH=/sbin:${PATH}

or you can add and alias

alias iwconfig="/sbin/iwconfig"

either one should work.  You will probably notice that you don't have permissions to change things.  You may want to set up sudo

see you /etc/sudoers file that will show you how to set it up.  Then change your alias to
alias iwconfig="sudo /sbin/iwconfig"

Or to solve all just log in as root (in a console) to do you wireless managing.  This can be easily done by typing su at the prompt.

It will then ask for the root password.  When you are done playing as root make sure you exit the su shell (don't su back to yourself)

0
 
LVL 5

Expert Comment

by:ITcrow
ID: 12013237

Previous poster has the right answer to your question.

At the same time, if you are working in some other shell, then you may want to know about files like
.login, .cshrc  for csh, .tcshrc for tcsh

Reason being, syntax could be different:
Eg. for csh or tcsh adding path could be done in one of the following ways:

> set path=( /sbin $path )
> set PATH="/sbin:$PATH"

You could verify the same using:
> echo $PATH
or
> echo $path

To know which shell you are using:
> echo $SHELL
or
> cat /etc/passwd | grep `whoami`

Get help on the shell you are using:
> man csh
> man tcsh
> man bash
etc.

0
 

Expert Comment

by:bigsqueaks
ID: 12213512
willy134 didn't mention a subtlety of su.

"su -" will let you be superuser with all of the path variables set
"su" will not grab all path variables for root, so some commands won't work
"su - <user>" let's you become any user on the system, and have all their path info set

The way I might have set my path would be

PATH=$PATH:/sbin/

That way I add sbin to the end of the path, so it searches there last. It can't cause problems with commands with the same name, where before you set the path variable it looked somewhere for the command, and now it uses the command from /sbin (rare, but possible)

Oh, to be explicit, the solution to your problem is to "su -" then run the "iwconfig" command. A normal user by default shouldn't be able to mess with wireless configuration settings. I would be wary of doing any sudo stuff, it shouldn't be necessary.
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

932 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

12 Experts available now in Live!

Get 1:1 Help Now