Solved

shell question

Posted on 2004-09-08
3
265 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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…

809 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