Solved

shell question

Posted on 2004-09-08
3
267 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Using sort and uniq to pare down large syslog 6 110
I NEED A "BARE" LINUX ... 9 123
Understanding ping command in Ubuntu 5 68
AWS Linux EC2 question on group 7 95
The purpose of this article is to demonstrate how we can use conditional statements using Python.
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 how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses

710 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