LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-18-2010, 10:15 AM   #1
sheykh
LQ Newbie
 
Registered: Jun 2007
Location: IL
Distribution: CentOS 5.5 (desktop) | CentOS 5.0 (MRTG Server)
Posts: 10

Rep: Reputation: 0
Question ifconfig not working as expected...


(Sorry if my RE is a little vague, unsure how else to word this!)

So I've finally settled on CentOS. Stable (AFAIK), looks good, and easy enough, yet not too easy enough. Make sense? Heh...

Well, up until a couple of days ago, ifconfig stopped working for me. Rather.... That command alone gives me the bash: ifconfig: command not found response. However... When I enter in /sbin/ifconfig command, it works fine.

Now, thanks to my friend Google, I know that ifconfig resides in that directory. I know that I can run with the /sbin/ in front of the command, and I can go on my merry way, and live the rest of my life underneath my umbrella of content. But lets be honest. I want it back! Heh

So I'm not sure what else I can give you so that you can just say, "Oh do this, that, and bodaboombadabing, you are back in business!". And all I can speculate, is that something happened to the 'link?' or whatever got debunked. So.... Ok. I'm ranting now. TIA!!!!

=D
 
Old 08-18-2010, 10:24 AM   #2
sem007
Member
 
Registered: Nov 2006
Distribution: RHEL, CentOS, Debian Lenny, Ubuntu
Posts: 638

Rep: Reputation: 113Reputation: 113
Check /sbin dir listed in your path variable


provide output of below command

Code:
echo $USER
echo $PATH
 
Old 08-18-2010, 10:38 AM   #3
sheykh
LQ Newbie
 
Registered: Jun 2007
Location: IL
Distribution: CentOS 5.5 (desktop) | CentOS 5.0 (MRTG Server)
Posts: 10

Original Poster
Rep: Reputation: 0
Code:
[shaun@localhost sbin]$ ls
accton                  ip                             multipath.static
addpart                 ip6tables                      nameif
adsl-connect            ip6tables-restore              nash
adsl-setup              ip6tables-save                 netplugd
adsl-start              ipmaddr                        netreport
adsl-status             ipppstats                      new-kernel-pkg
adsl-stop               iprofd                         nologin
agetty                  iptables                       pam_console_apply
alsactl                 iptables-restore               pam_tally
arp                     iptables-save                  pam_tally2
arping                  iptunnel                       pam_timestamp_check
audispd                 isdnctrl                       parted
auditctl                isdnlog                        partprobe
auditd                  iwconfig                       partx
aureport                iwevent                        pcbitctl
ausearch                iwgetid                        pccardctl
autrace                 iwlist                         pcmcia-check-broken-cis
avmcapictrl             iwpriv                         pcmcia-socket-startup
badblocks               iwspy                          pidof
blkid                   kdump                          pivot_root
blockdev                kexec                          plipconfig
busybox                 killall5                       portmap
capiinit                klogd                          poweroff
cbq                     kpartx                         pppoe
cciss_id                kpartx.static                  pppoe-relay
change_console          kudzu                          pppoe-server
chkconfig               ldconfig                       pppoe-sniff
clock                   logsave                        ppp-watch
consoletype             loopctrl                       pvscan
cryptsetup              losetup                        quotacheck
ctrlaltdel              lsmod                          quotaoff
debugfs                 lspci                          quotaon
delpart                 lspcmcia                       rdisc
depmod                  lsusb                          rdump
dhclient                lvm                            rdump.static
dhclient-script         lvm.static                     reboot
dhcp6c                  MAKEDEV                        request-key
dm_dso_reg_tool         makedumpfile                   resize2fs
dmeventd                mcstransd                      restore
dmevent_tool            mdadm                          restorecon
dmraid                  mdadm.static                   restore.static
dmraid.static           mdassemble.static              rmmod
dmsetup                 mdmpd                          rmt
dmsetup.static          mgetty                         rngd
dosfsck                 microcode_ctl                  route
dosfslabel              mii-diag                       rpc.lockd
dump                    mii-tool                       rpc.statd
dumpe2fs                mingetty                       rrestore
dump.static             mkbootdisk                     rrestore.static
e2fsck                  mkdosfs                        rtmon
e2image                 mkdumprd                       runlevel
e2label                 mke2fs                         runuser
ether-wake              mkfs                           salsa
ethtool                 mkfs.cramfs                    scsi_id
extlinux                mkfs.ext2                      service
fdisk                   mkfs.ext3                      setfiles
findfs                  mkfs.msdos                     setkey
firmware_helper         mkfs.vfat                      setpci
fixfiles                mkinitrd                       setsysfont
fsck                    mkswap                         sfdisk
fsck.cramfs             mkzonedb                       sgpio
fsck.ext2               modinfo                        shutdown
fsck.ext3               modprobe                       slattach
fsck.msdos              mount.cifs                     sln
fsck.vfat               mount.ecryptfs                 start_udev
fstab-decode            mount.ecryptfs_private         sulogin
fuser                   mount.nfs                      swapoff
generate-modprobe.conf  mount.nfs4                     swapon
genhostid               mount.vmhgfs                   sysctl
getkey                  mpath_ctl                      syslogd
grub                    mpath_prio_alua                tc
grubby                  mpath_prio_alua.static         telinit
grub-install            mpath_prio_emc                 tune2fs
grub-md5-crypt          mpath_prio_emc.static          udevcontrol
grub-terminfo           mpath_prio_hds_modular         udevd
halt                    mpath_prio_hds_modular.static  udevd.static
hdparm                  mpath_prio_hp_sw               udevsettle
hisaxctrl               mpath_prio_hp_sw.static        udevtrigger
hwclock                 mpath_prio_intel               umount.cifs
ibod                    mpath_prio_intel.static        umount.ecryptfs
icnctrl                 mpath_prio_netapp              umount.ecryptfs_private
ifcfg                   mpath_prio_netapp.static       umount.nfs
ifconfig                mpath_prio_ontap               umount.nfs4
ifdown                  mpath_prio_ontap.static        unix_chkpwd
ifenslave               mpath_prio_rdac                unix_update
ifrename                mpath_prio_rdac.static         update-pciids
ifup                    mpath_prio_tpc                 vboxd
init                    mpath_prio_tpc.static          vconfig
initlog                 mpath_prio_weighted            vgchange
insmod                  mpath_prio_weighted.static     vgscan
insmod.static           mpath_wait                     weak-modules
install-info            multipath                      ypbind


[shaun@localhost sbin]$ echo $USER
shaun


[shaun@localhost sbin]$ echo $PATH
/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/shaun/bin
This what you need? =D Thank you by the way!!!!!
 
Old 08-18-2010, 10:45 AM   #4
sem007
Member
 
Registered: Nov 2006
Distribution: RHEL, CentOS, Debian Lenny, Ubuntu
Posts: 638

Rep: Reputation: 113Reputation: 113
Quote:
This what you need? =D Thank you by the way!!!!!
nope dear..

Any way you are loging through non-root user. /sbin dir not listed in non-root user's PATH.

only root or privileged users can run commands of /sbin /usr/sbin and /usr/local/sbin

run below command to verify your path

Code:
for non-root user
$ echo $PATH
/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/u1/bin

root user
# echo $PATH
/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

Last edited by sem007; 08-18-2010 at 10:48 AM. Reason: provide more detail
 
Old 08-18-2010, 10:52 AM   #5
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,528

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
You can execute ifconfig as a user, if you provide the whole path
Code:
/sbin/ifconfig
 
Old 08-18-2010, 11:07 AM   #6
sheykh
LQ Newbie
 
Registered: Jun 2007
Location: IL
Distribution: CentOS 5.5 (desktop) | CentOS 5.0 (MRTG Server)
Posts: 10

Original Poster
Rep: Reputation: 0
Code:
[root@localhost /]# echo $PATH
/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/shaun/bin
[root@localhost /]# ifconfig
bash: ifconfig: command not found
Sorry. Thought I was root. Still learning... ;]~ But as so far... I cannot wait to get my new lappy, and straight out of the door, running CentOS, instead of bowing down to WIN7!!! LoL! TIA everyone! =]
 
Old 08-18-2010, 11:13 AM   #7
sem007
Member
 
Registered: Nov 2006
Distribution: RHEL, CentOS, Debian Lenny, Ubuntu
Posts: 638

Rep: Reputation: 113Reputation: 113
Quote:
Originally Posted by sheykh View Post
Code:
[root@localhost /]# echo $PATH
/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/shaun/bin
[root@localhost /]# ifconfig
bash: ifconfig: command not found
Sorry. Thought I was root. Still learning... ;]~ But as so far... I cannot wait to get my new lappy, and straight out of the door, running CentOS, instead of bowing down to WIN7!!! LoL! TIA everyone! =]
# prompt display on your screen but i am sure you are login as non-root user.
Quote:
/home/shaun/bin
you are login as shaun user Am i right?

if yes then you have to give full path of command.

Code:
/sbin/ifconfig
 
Old 08-18-2010, 11:18 AM   #8
sheykh
LQ Newbie
 
Registered: Jun 2007
Location: IL
Distribution: CentOS 5.5 (desktop) | CentOS 5.0 (MRTG Server)
Posts: 10

Original Poster
Rep: Reputation: 0
Code:
[shaun@localhost ~]$ echo $USER
shaun
[shaun@localhost ~]$ echo $PATH
/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/shaun/bin
[shaun@localhost ~]$ su
Password:
[root@localhost shaun]# echo $USER
shaun
[root@localhost shaun]# echo $PATH
/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/shaun/bin
[root@localhost shaun]#
Yes... I am logged in with my user account shaun (Yea, my real name, hello btw!! LoL!) and then I su to get to root.... So if I am doing something wrong, or not doing it the 'right' way. Please lemme know. Again.... NOOB!!!!! su is all I've learned... So far. *evil grin*
 
Old 08-18-2010, 11:23 AM   #9
sem007
Member
 
Registered: Nov 2006
Distribution: RHEL, CentOS, Debian Lenny, Ubuntu
Posts: 638

Rep: Reputation: 113Reputation: 113
Quote:
Originally Posted by sheykh View Post
Code:
[shaun@localhost ~]$ echo $USER
shaun
[shaun@localhost ~]$ echo $PATH
/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/shaun/bin
[shaun@localhost ~]$ su
Password:
[root@localhost shaun]# echo $USER
shaun
[root@localhost shaun]# echo $PATH
/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/shaun/bin
[root@localhost shaun]#
Yes... I am logged in with my user account shaun (Yea, my real name, hello btw!! LoL!) and then I su to get to root.... So if I am doing something wrong, or not doing it the 'right' way. Please lemme know. Again.... NOOB!!!!! su is all I've learned... So far. *evil grin*
hi shaun

if you want to become root just run su command as below

Code:
$ su -
or 
$ su - root
and then check your PATH

Code:
echo $PATH
 
Old 08-18-2010, 11:40 AM   #10
sheykh
LQ Newbie
 
Registered: Jun 2007
Location: IL
Distribution: CentOS 5.5 (desktop) | CentOS 5.0 (MRTG Server)
Posts: 10

Original Poster
Rep: Reputation: 0
Code:
[root@localhost shaun ~]# su - root
[root@localhost ~]# echo $PATH
/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
HI! =]

That what you need now? I see :/sbin/: in the $PATH. So, shouldn't su then ifconfig be working? *tear*
 
Old 08-18-2010, 11:47 AM   #11
sem007
Member
 
Registered: Nov 2006
Distribution: RHEL, CentOS, Debian Lenny, Ubuntu
Posts: 638

Rep: Reputation: 113Reputation: 113
Quote:
Originally Posted by sheykh View Post
Code:
[root@localhost shaun ~]# su - root
[root@localhost ~]# echo $PATH
/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
HI! =]

That what you need now? I see :/sbin/: in the $PATH. So, shouldn't su then ifconfig be working? *tear*
ok now run ifconfig at shell and see what happen

Code:
# ifconfig
 
Old 08-18-2010, 11:53 AM   #12
sheykh
LQ Newbie
 
Registered: Jun 2007
Location: IL
Distribution: CentOS 5.5 (desktop) | CentOS 5.0 (MRTG Server)
Posts: 10

Original Poster
Rep: Reputation: 0
almost....there.....

Code:
[shaun@localhost ~]$ ifconfig
bash: ifconfig: command not found
[shaun@localhost ~]$ su
Password:
[root@localhost shaun]# ifconfig
bash: ifconfig: command not found
[root@localhost shaun]# su - root
[root@localhost ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0C:29:4F:05:CC
          inet addr:10.11.8.22  Bcast:10.11.8.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe4f:5cc/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:581004 errors:0 dropped:0 overruns:0 frame:0
          TX packets:388944 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:524565816 (500.2 MiB)  TX bytes:306291525 (292.1 MiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:1239 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1239 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:2082593 (1.9 MiB)  TX bytes:2082593 (1.9 MiB)
Worked. However, I know that su then ifconfig used to work. I know it did. I haven't taken any crazy pills in a couple of weeks (GOTTA get off that stuff!!), but I swear it worked before. And I'm not sure what I did to bork it (I had to have done something...)
 
Old 08-18-2010, 12:04 PM   #13
sem007
Member
 
Registered: Nov 2006
Distribution: RHEL, CentOS, Debian Lenny, Ubuntu
Posts: 638

Rep: Reputation: 113Reputation: 113
Quote:
but I swear it worked before. And I'm not sure what I did to bork it (I had to have done something...)
you can do this way. ( just do this as testing only)


login as non-root user.
open your local profile

Code:
$ vim .bash_profile

PATH=$PATH:$HOME/bin:/sbin <- add /sbin

save file and logout and login user
settings for redhat/centos OS

Hope this help

Best of luck.
 
1 members found this post helpful.
Old 08-18-2010, 12:34 PM   #14
sheykh
LQ Newbie
 
Registered: Jun 2007
Location: IL
Distribution: CentOS 5.5 (desktop) | CentOS 5.0 (MRTG Server)
Posts: 10

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by sem007 View Post
Code:
$ vim .bash_profile

PATH=$PATH:$HOME/bin:/sbin <- add /sbin

save file and logout and login user
That worked like a champ! Didn't need to su. Granted, I see what it is that I did. Basically the same thing as W$ users "paths". Correct? You mentioned that this isn't really a fix, but more a test. Right?

Last edited by sheykh; 08-18-2010 at 12:34 PM. Reason: fix quote
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
find not working as expected luusac Linux - Newbie 8 08-28-2008 12:07 PM
Umount not working as expected hexalite2k5 Red Hat 0 09-09-2007 12:51 PM
Useradd - not working as expected Paean Solaris / OpenSolaris 13 01-31-2006 05:06 PM
Crontab not working as expected nro Linux - Newbie 7 08-29-2005 01:56 PM
up2date not working as expected johnny13 Linux - Newbie 7 07-21-2003 02:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:50 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration