Menu

Main Menu
Talk Get Daily Search

Member's Online

    User Name
    Password

    Don't put "sudo gainroot" in /home/user/.profile!

    Reply
    sping | # 1 | 2007-08-13, 13:12 | Report

    Just thought I should share my experience, in the hope that others might see this and avoid my mistake.

    It seems obvious in hindsight, but I put "sudo gainroot" in /home/user/.profile, because every time I used xterm, I wanted root access.

    Unfortunately, something at the end of the boot process must use a shell, and it can't run as root, because with this change the N800 halts its boot when the progress bar is fully right.

    Yeah, I know, it seems obvious now, but I didn't think the change through, and kept re-doing it after a reflash (reflash, install xterm, gainroot, start adding other stuff, and it would be fine until I rebooted). I wasted lots of time.

    Edit | Forward | Quote | Quick Reply | Thanks

     
    Milhouse | # 2 | 2007-08-13, 13:20 | Report

    Or maybe check if the session is interactive and only then gainroot - I don't think $TERM is defined for non-interactive sessions/logins. And isn't .login executed only by interactive logins? Could depend on the shell though.

    Edit | Forward | Quote | Quick Reply | Thanks

     
    Milhouse | # 3 | 2007-08-13, 13:29 | Report

    /home/user/.profile will be executed three times during the boot process (at least on my 4.2007 N800) and each time TERM will be set to "linux" but when logging in interactively via xterm, TERM will be set to xterm so the easy solution is to check $TERM and if it's set to xterm call sudo gainroot.

    Edit | Forward | Quote | Quick Reply | Thanks

     
    fanoush | # 4 | 2007-08-13, 14:28 | Report

    Originally Posted by sping View Post
    I put "sudo gainroot" in /home/user/.profile, because every time I used xterm, I wanted root access.
    It is a bit like having a house with front door leading directly to your bedroom :-)

    You can shoot yourself in the foot quite easily and in many unexpected ways while being always root. What about creating just one letter alias to sudo gainroot in your .profile (or .bashrc if .profile reads it)?
    Code:
    alias r='sugo gainroot'
    then you can just type r + enter

    Edit | Forward | Quote | Quick Reply | Thanks

    Last edited by fanoush; 2007-08-13 at 14:31.

     
    gigabites | # 5 | 2007-08-14, 11:29 | Report

    Originally Posted by fanoush View Post
    What about creating just one letter alias to sudo gainroot in your .profile (or .bashrc if .profile reads it)?
    Code:
    alias r='sugo gainroot'
    then you can just type r + enter
    how do you do that if you don't have a /home/user/.profile?

    obviously I'm not cli savvy.
    thanks

    Edit | Forward | Quote | Quick Reply | Thanks

     
    fanoush | # 6 | 2007-08-14, 12:32 | Report

    Originally Posted by gigabites View Post
    how do you do that if you don't have a /home/user/.profile?
    then create it, run this in xterm (as ordinary user)
    Code:
    echo 'alias r="sudo gainroot"' >>/home/user/.profile
    better use cut and paste, it is double quotes inside single quotes

    you will need to close and reopen osso-xterm (the advanced one) or reboot for the definition to take effect

    Edit | Forward | Quote | Quick Reply | Thanks

     
    i.rachita | # 7 | 2007-08-17, 09:52 | Report

    Originally Posted by fanoush View Post
    you will need to close and reopen osso-xterm (the advanced one) or reboot for the definition to take effect
    or run
    Code:
    source /home/user/.profile

    Edit | Forward | Quote | Quick Reply | Thanks

     
vBulletin® Version 3.8.8
Normal Logout