Linux - NewbieThis 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!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I have asked about this topic before but haven't really gotten a grasp of it, so I'm asking for more help if possible.
bottom line is I want to be able to run 'ifconfig' and other commands like it as my user (instead of root)... but I can't unless I'm logged in as root. It won't even work if I'm logged in as my user and su over to root. Prior posts said I needed to change the PATH for my user. Here's what I have:
[user1@localhost ~]$ $PATH
bash: /usr/kerberos/bin:/usr/lib/ccache:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/user1/bin: No such file or directory
[user1@localhost ~]$ su
[root@localhost user1]# $PATH
bash: /usr/kerberos/sbin:/usr/kerberos/bin:/usr/lib/ccache:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/user1/bin: No such file or directory
Since they look basically the same, what the heck is going on? Do I need to add a path or what? Thanks for the help.
cool, thanks rupertwh, that solved half of the conundrum. How can I add the same path to user so that I can execute that command as user instead of having to switch to root every time? (or is that not a smart idea?)
How can I add the same path to user so that I can execute that command as user instead of having to switch to root every time?
To modify (anyone's) PATH, do this: export PATH="$PATH:<newpathname>"
eg, to add /sbin:
To make the entry permanent, you have to modify one of the startup scripts. Which one depends on the distro.
What hasn't been said is that you can run the command from anywhere in the directory tree, if you enter the full path to the executable: example: /sbin/ifconf.
Also not mentioned is the matter of permission: if the user doesn't have permission to execute, it won't matter how you enter the command.
Last edited by bigrigdriver; 12-01-2007 at 05:51 PM.
Use sudo and include the path in the command.
If you want to just list the information as in the above command, then you don't need to run the command as root, and don't need sudo. If you want to set the IP address or gateway address of an interface than you need to do that as root.
Actually, su means to switch user, (by default to root if you are non-root), but you can switch to any user from root if you want to test their env.
As mentioned, use the '-' empty switch to get the tgt user's env, otherwise you keep your env.