FAQ   Search   Memberlist  
Profile    Log in to check your private messages    Register    Log in
Unable to run some commands even while SU

 
Post new topic   Reply to topic    BLAG Forum Index -> support
View previous topic :: View next topic  
Author Message
magnet
PostPosted: Sat Jun 19, 2004 8:36 am    Post subject: Unable to run some commands even while SU Reply with quote

Hello again. I use ndiswrapper to utilize my drivers for the wireless card I have, so often times when I boot into a linux distro I have to run the modprobe/ifconfig commands to get my card 'online.' However, I've noticed that when I'm logged into my user account I can't use these commands, not even when I SU. I don't remember this happenening at first, but it happened again tonight for the second time I think. I can log out of my user account (magnet) and then log in as root and get my stuff working, but that's kind of inconvenient and I don't see why I can't use the commands as 'magnet' anymore. Any ideas?
magnet
PostPosted: Sat Jun 19, 2004 9:22 pm    Post subject: Reply with quote

This is getting obscene. Maybe I never could use those commands while logged in as a regular user...but I swear I could. Either way I've reinstalled to start anew, to see if it was something I did that screwed it up, but I still can't do commands like modprobe and iw/ifconfig. And now I can't seem to mount my windows partition correctly. I added the same entry to /etc/fstab as I did last time, and last time it worked...but now it doesn't. Well, let me clarify...last time I could read files in the mounted windows dir (I mounted /dev/hda2 to /mnt/win) when I was logged in as the normal user. Now I can't. It seems like I can only do anything I'd like to do when I'm actually logged in as root (not SU, I've tried that).

What's happening? :( Please help I'm getting very frustrated.

jebba
PostPosted: Sun Jun 20, 2004 1:43 am    Post subject: Reply with quote

The reason you can't run the commands when you `su` to root is that they are not in your $PATH.

There are a couple solutions. I'll use `ifconfig` as an example.

Code:
su
ifconfig


will give you:
"bash: ifconfig: command not found"

Code:
su -
ifconfig


will run ifconfig. The "-" means to read in root's environment variables, which adds /sbin to the path.

Code:
su
/sbin/ifconfig


This will also run ifconfig, since an absolute PATH is specified.

Another approach would be to add /sbin & /usr/sbin to your own PATH.

vi .bashrc (or whatever editor you use). Add the line:
Code:
PATH=$PATH:/sbin:/usr/sbin


Once you log out and back in, these will be your settings, so you won't run into command not found when you run stuff in /sbin & /usr/sbin

-Jeff

magnet
PostPosted: Sun Jun 20, 2004 5:39 pm    Post subject: Reply with quote

Thank you very much good sir about the commands. Do you know what happened to my ability to view the mounted partition though? It's a big inconvenience to be unable to access it in programs like XMMS as a regular user.
magnet
PostPosted: Tue Jun 22, 2004 6:29 am    Post subject: Reply with quote

Okay, never mind the mounting stuff. When I edited my /etc/fstab again I placed the wrong command there, so 'magnet' couldn't see it. But I've got it working now. Thanks again.
Display posts from previous:   
Post new topic   Reply to topic    BLAG Forum Index -> support
Page 1 of 1

Protected by Anti-Spam ACP