Find the answer to your Linux question:
Results 1 to 6 of 6
Hello All, I've just installed Debian on a nice older laptop I had and I've used Linux before a bit but have run into a problem here. I have a ...
  1. #1
    Just Joined!
    Join Date
    Nov 2009
    Posts
    6

    Utility Installation Troubles



    Hello All,

    I've just installed Debian on a nice older laptop I had and I've used Linux before a bit but have run into a problem here.

    I have a TON of software I've got ready that I need to install on here, but after trying the first few I'm going to to have to hold off until the problem is resolved.

    Basically, I was installing the programs as root (via su root) which maybe caused it in the first place. So then I modified my sudoers file to allow my regular account to use sudo and installed again with sudo.

    The problem is that root can run all sorts of utilities/programs (or using sudo I can) but is there a way around this? So that I can run programs without having to type sudo before each of them?

    For instance, the Debian install came with the iwconfig util., but I can only run it as root/sudo, so I attempted to install Ruby from the source (which didn't work - ton of errors for some reason), tried again with Checkinstall -D Make Install (more errors and a fail) and finally found a .deb package online which I downloaded and installed (although I dont think it worked 100% properly because I got some errors but it appears that most of it installed properly because I then went to install the ifconfig utility but, again, it only worked for root.

    I know it's unsafe to use root as your main account (and on my Debian it wont even let me login as root on the main screen) so how can I avoid these annoying sudo/su problems so that I can use my account and still use software installed by root? (I don't mind installing as root w/ sudo - I do mind using sudo before every util command as a regular user).

    Thanks so much for the help!

    -Ellipsis

  2. #2
    Just Joined!
    Join Date
    Nov 2009
    Posts
    6
    Okay, so I managed to reconfigure my apt-get sources.list file and install ruby fine but I'm still having two main problems.

    1.) ifconfig - tried running as root and regular user (and added /sbin to PATH in the profile config file). When I type locate ifconfig it says it's in /sbin but when I check there or try to run it from there it's not there (command not found).

    2.) iwconfig - can run as root but not as regular user even though I changed the PATH variable

    Help is greatly appreciated!

  3. #3
    Linux Guru reed9's Avatar
    Join Date
    Feb 2009
    Location
    Boston, MA
    Posts
    4,653
    You may need to add your user to the netdev group.
    Code:
    sudo gpasswd -a <USER> netdev
    For programs that require sudo to run, you can create an alias in ~/.bashrc, for example
    Code:
    alias apt-get="sudo apt-get"
    and you can change /etc/sudoers to not ask for a password with sudo, either as a whole, or for specific programs.
    Sudo - ArchWiki

  4. #4
    Just Joined!
    Join Date
    Nov 2009
    Posts
    6
    Thank you, that fixed the iwconfig problem but I still don't think the system has ifconfig installed on it even though the nettools package that's installed says it includes the utility, and when I type locate ifconfig it says its in /sbin and it also shows the man page location but, again, it doesn't work no matter which user I try (root vs. standard).

    Thanks again!

  5. #5
    Linux Guru reed9's Avatar
    Join Date
    Feb 2009
    Location
    Boston, MA
    Posts
    4,653
    What if you type the full path, ie
    Code:
    /sbin/ifconfig

  6. #6
    Just Joined!
    Join Date
    Jan 2008
    Posts
    53

    Wink Could it be this secure?

    I understand you want to do it easy, but trying this "avoid su command", are not you letting insecure your system? can anybody explain me if it is secure, from my point of view it is not!

    GNU/Linux is well known for its security level, well in that way learn it, and it is the reason why i used it now a days, there are both bin and sbin directories located in / and /usr, where the bin directory are commandos for normal users only and sbin for root only so trying to use a root user you must have root privileges, i do not feel unconfortable doing "su -" to execute a commando, but i feel more secure to know what i run and under on what privileges i am running it, if you are going to install a tar ball is well known you can do "./configure,make" as normal user but you must log in as root to execute "make install", this because one reason, an user must not change or touch the system.

    Is not bad idea trying to simplify it but you will get use to it, and then you will have an administrator MS-windows like enviromente, then do not blame the GNU/Linux for doing something you did it by your self, we are humans, and we make mistakes, i think that being root on a GNU/Linux OS is not scary but you must know what are you doing, and we are use to make mistakes, in somewhere in timeline you will forget it and do somethink you will say your self, "i should not do this!".

    For Every script i create and before run it i make a backup of my files, always that i will run it as root, by experience some times at my beginning learning i did horrible things to my systems, i did erase parts and that was because i run everithing in a root enviroment. i.e. One time i did a simple script to clean garbage and files i did stop to being viewed passed a time, and it was usefull just for the users folders, but for a mistake i did run it under root privileges and erase a lot of files, being finished, at rebooting the system some time ago everything start to crash, it was my pc so nothing scare, but a mistake i take it on count, and it was not the script the gilty it was me, because the script was right, it do what i told it to do, and what i wanted, but it search and clean all what root did not read in the specific time, so it was garbage for the script, i could make restrictions but it was more than a simple script, why? it was my need, but the point is other.

    So think having all the privileges and deleting and erasing, executing and everithing from your user privileges acount as if you were the "MS-Windows privileged" root user in GNU/Linux, you will return to an MS-Windows system like.

    That is why i abandon MS-products because the user could be an administrator and i could do everything. Worms, virus get into my system and bye,bye, all for my administrator privileges. In linux there are not virus but other kind of malware, the hard ones called rootkits, so beware.

    So you can gain root privileges as root but is not good idea. Being able to execute administrators comandos, you will not have much time until you download something and without reading what it really does, you will install a rootkit in your OS, or a malware, you are killing your self or exposing it to others.

    Is just my point of view, if I am wrong correct me please!

    If you steel want to do it like that, follow what "reed9" wrote, is the best solution.

    To make it easy what you need to do is to make an alias to every commando in /sbin and /usr/sbin, it can be done executing the following scripts.

    NOTE: Change username by your real username

    for /sbin run this:

    for item in `ls /sbin`; do
    if [[ ! -d $item ]]; then
    echo "alias $item=\"sudo /sbin/"$item"\"" >> /home/username/.bashrc
    fi
    done

    for /usr/sbin you can run this:
    for item in `ls /usr/sbin`; do
    if [[ ! -d $item ]]; then
    echo "alias $item=\"sudo /usr/sbin/"$item"\"" >> /home/username/.bashrc
    fi
    done

    Then check and verify if it's correct in the file .bashrc of your user and change username by your real username.

    Any way i am still thinking it is not right to run commands that only root must run, but anyway , try it!

    Have fun!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •