Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 270
  • Last Modified:

shell question

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
daggodt
Asked:
daggodt
1 Solution
 
willy134Commented:
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
 
ITcrowCommented:

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
 
bigsqueaksCommented:
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

Microsoft Certification Exam 74-409

VeeamĀ® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now