[K12OSN] Re: The "can't log in as root to fix the 'can't log in as root'" conundrum

John Lucas mrjohnlucas at gmail.com
Wed Jan 7 13:26:43 UTC 2009


Carl Keil wrote:
>>
>> David Hopkins wrote:
>>  
>>     Can you just use "su root" to get root ownership in a terminal 
>> session
>>     after logging in with your normal account?  I normally use su - root
>>     to get the full login environment, but su root should give you root
>>     privileges, right?
>>        
> 
>> Yes, as will a plain "su". The dash argument to su means "execute my 
>> start-up scripts and set up my environment." Without the dash, you 
>> don't get that, meaning you also won't have root's path variable set. 
>> That means you'll hafta specify the path to things like /sbin/ifconfig 
>> (and other commands). The other argument to su is the username. 
>> Without a username specified, su assumes you mean root. 
> 
> Thank you so much.  "su - root" didn't work, so I gave up on the whole 
> su thing.  I was hoping there was a simple fix.
> Can I ask?  What do you think the best actual fix for the original 
> problem is?
> 
> 1)  mv /root /home/
> 2) ln -s /root /home/root
> 3) cp -a /root /home/
> 4) vi /etc/passwd
> 5) other... please explain
> 
> Thanks again,
> 
> ck

I came into the middle of this thread so I missed which distro you are using, 
but the first thing to investigate is *why* root's home dir changed. Did you by 
any chance add root to the LDAP tree? That shouldn't have been needed, but you 
could change that attribute (home directory) with LDAP tools. If root is in 
/etc/passwd then you could change the home directory using vipw *if* you can 
gain root privs. If you can use "sudo" then you can gain those privs with: sudo 
bash, then manually adjust you environment (export PATH= ...), make the change 
and done. You should still be able to use "su" (without "-") make your changes 
and done.

Good luck.

-- 
         "History doesn't repeat itself; at best it rhymes."
                         - Mark Twain

| John Lucas                MrJohnLucas at gmail.com               |
| St. Thomas, VI 00802      http://mrjohnlucas.googlepages.com/ |
| 18.3°N, 65°W              AST (UTC-4)                         |




More information about the K12OSN mailing list