Solved

shell question

Posted on 2004-09-08
3
263 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
Comment Utility
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
Comment Utility

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
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

This is the error message I got (CODE) Error caused by incompatible libmp3lame 3.98-2 with ffmpeg I've googled this error message and found out sometimes it attaches this note "can be treated with downgrade libmp3lame to version 3.97 or 3.98" …
SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
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…
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.

763 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

9 Experts available now in Live!

Get 1:1 Help Now